From 49b5a1f5dc74a0e693a51409252b3d590cc00bbb Mon Sep 17 00:00:00 2001 From: nobody <> Date: Thu, 20 Apr 2006 20:13:22 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'readline_5_1 -import-branch'. Sprout from msnyder-reverse-20060331-branch 2006-03-31 19:47:12 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'msnyder-' Cherrypick from master 2006-04-20 20:13:20 UTC Elena Zannoni 'touched all sources to ease import of readline-5.1': ChangeLog Makefile.def Makefile.in Makefile.tpl bfd/ChangeLog bfd/Makefile.am bfd/Makefile.in bfd/config.bfd bfd/configure bfd/configure.in bfd/doc/ChangeLog bfd/doc/Makefile.am bfd/doc/Makefile.in bfd/elf32-bfin.c bfd/elf32-i386.c bfd/elf32-m32c.c bfd/elf32-sparc.c bfd/elf32-xtensa.c bfd/elf64-hppa.c bfd/elfcode.h bfd/elflink.c bfd/elfxx-ia64.c bfd/elfxx-sparc.c bfd/elfxx-sparc.h bfd/po/Make-in bfd/po/SRC-POTFILES.in bfd/targets.c bfd/version.h bfd/warning.m4 configure configure.in cpu/ChangeLog cpu/m32c.opc etc/ChangeLog etc/Makefile.in etc/configure etc/configure.in etc/configure.texi gdb/ChangeLog gdb/MAINTAINERS gdb/Makefile.in gdb/alpha-tdep.c gdb/arm-linux-tdep.c gdb/arm-tdep.c gdb/breakpoint.c gdb/breakpoint.h gdb/cli/cli-script.c gdb/config/i386/nm-i386.h gdb/config/pa/linux.mh gdb/config/sparc/linux.mh gdb/config/sparc/linux64.mh gdb/corelow.c gdb/cris-tdep.c gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/dwarf2-frame.c gdb/dwarf2-frame.h gdb/exec.c gdb/frame.h gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/hppa-linux-tdep.c gdb/hppa-tdep.c gdb/i386-nat.c gdb/i386-stub.c gdb/ia64-tdep.c gdb/infrun.c gdb/linux-nat.c gdb/linux-nat.h gdb/linux-thread-db.c gdb/m32r-rom.c gdb/m32r-stub.c gdb/m32r-tdep.c gdb/m68k-stub.c gdb/m68klinux-tdep.c gdb/mem-break.c gdb/mips-tdep.c gdb/monitor.c gdb/nto-procfs.c gdb/ocd.c gdb/ocd.h gdb/ppc-linux-tdep.c gdb/ppc-tdep.h gdb/procfs.c gdb/remote-e7000.c gdb/remote-m32r-sdi.c gdb/remote-mips.c gdb/remote-rdp.c gdb/remote-sds.c gdb/remote-sim.c gdb/remote-st.c gdb/remote.c gdb/remote.h gdb/rs6000-nat.c gdb/rs6000-tdep.c gdb/s390-tdep.c gdb/serial.c gdb/sh-stub.c gdb/sh-tdep.c gdb/sh-tdep.h gdb/sol-thread.c gdb/solib-irix.c gdb/sparc-linux-nat.c gdb/sparc-linux-tdep.c gdb/sparc-stub.c gdb/sparc-tdep.c gdb/sparc64-linux-nat.c gdb/sparc64-linux-tdep.c gdb/sparc64-tdep.c gdb/stack.c gdb/target.c gdb/target.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/commands.exp gdb/testsuite/gdb.base/float.exp gdb/testsuite/gdb.mi/mi-until.exp gdb/testsuite/gdb.mi/mi2-until.exp gdb/tracepoint.c gdb/value.c gdb/value.h gdb/version.in gdb/win32-nat.c gdb/wince.c include/ChangeLog include/bfdlink.h include/libiberty.h include/opcode/ChangeLog include/opcode/avr.h libiberty/ChangeLog libiberty/Makefile.in libiberty/configure libiberty/configure.ac libiberty/functions.texi libiberty/pex-common.c libiberty/pex-common.h libiberty/pex-djgpp.c libiberty/pex-msdos.c libiberty/pex-unix.c libiberty/pex-win32.c libiberty/pexecute.txh libiberty/testsuite/Makefile.in opcodes/ChangeLog opcodes/Makefile.am opcodes/Makefile.in opcodes/avr-dis.c opcodes/configure opcodes/m32c-asm.c opcodes/pdp11-opc.c opcodes/po/Make-in opcodes/po/POTFILES.in opcodes/po/vi.po readline/CHANGELOG readline/CHANGES readline/COPYING readline/ChangeLog.gdb readline/INSTALL readline/MANIFEST readline/Makefile.in readline/NEWS readline/README readline/USAGE readline/acconfig.h readline/aclocal.m4 readline/ansi_stdlib.h readline/bind.c readline/callback.c readline/chardefs.h readline/compat.c readline/complete.c readline/config.h.bot readline/config.h.in readline/configure readline/configure.in readline/cross-build/cygwin.cache readline/display.c readline/doc/ChangeLog.gdb readline/doc/Makefile.in readline/doc/fdl.texi readline/doc/hist.texinfo readline/doc/history.3 readline/doc/history.pdf readline/doc/history.texi readline/doc/hstech.texi readline/doc/hstech.texinfo readline/doc/hsuser.texi readline/doc/hsuser.texinfo readline/doc/inc-hist.texinfo readline/doc/manvers.texinfo readline/doc/readline.3 readline/doc/readline.pdf readline/doc/rlman.texi readline/doc/rlman.texinfo readline/doc/rltech.texi readline/doc/rltech.texinfo readline/doc/rluser.texi readline/doc/rluser.texinfo readline/doc/rluserman.pdf readline/doc/rluserman.texi readline/doc/rluserman.texinfo readline/doc/texi2dvi readline/doc/texi2html readline/doc/version.texi readline/emacs_keymap.c readline/examples/ChangeLog.gdb readline/examples/Inputrc readline/examples/Makefile.in readline/examples/excallback.c readline/examples/fileman.c readline/examples/histexamp.c readline/examples/manexamp.c readline/examples/readlinebuf.h readline/examples/rl-fgets.c readline/examples/rl.c readline/examples/rlcat.c readline/examples/rlfe.c readline/examples/rlptytest.c readline/examples/rltest.c readline/examples/rlversion.c readline/funmap.c readline/histexpand.c readline/histfile.c readline/histlib.h readline/history.c readline/history.h readline/histsearch.c readline/input.c readline/isearch.c readline/keymaps.c readline/keymaps.h readline/kill.c readline/macro.c readline/mbutil.c readline/misc.c readline/nls.c readline/parens.c readline/posixdir.h readline/posixjmp.h readline/posixstat.h readline/readline.c readline/readline.h readline/rlconf.h readline/rldefs.h readline/rlmbutil.h readline/rlprivate.h readline/rlshell.h readline/rlstdc.h readline/rltty.c readline/rltty.h readline/rltypedefs.h readline/rlwinsize.h readline/savestring.c readline/search.c readline/shell.c readline/shlib/Makefile.in readline/signals.c readline/support/config.guess readline/support/config.rpath readline/support/config.sub readline/support/install.sh readline/support/mkdirs readline/support/mkdist readline/support/mkinstalldirs readline/support/shlib-install readline/support/shobj-conf readline/support/wcwidth.c readline/tcap.h readline/terminal.c readline/text.c readline/tilde.c readline/tilde.h readline/undo.c readline/util.c readline/vi_keymap.c readline/vi_mode.c readline/xmalloc.c readline/xmalloc.h sim/ChangeLog sim/cris/Makefile.in sim/cris/configure sim/cris/configure.ac sim/cris/cris-sim.h sim/cris/cris-tmpl.c sim/cris/crisv10f.c sim/cris/crisv32f.c sim/cris/devices.c sim/cris/dv-cris.c sim/cris/dv-rv.c sim/cris/rvdummy.c sim/cris/sim-if.c sim/cris/sim-main.h sim/d10v/ChangeLog sim/d10v/interp.c sim/mips/ChangeLog sim/mips/dv-tx3904tmr.c sim/testsuite/ChangeLog sim/testsuite/sim/cris/asm/testutils.inc sim/testsuite/sim/cris/asm/x0-v10.ms sim/testsuite/sim/cris/asm/x0-v32.ms sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms sim/testsuite/sim/cris/hw/rv-n-cris/quit.s sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp sim/testsuite/sim/cris/hw/rv-n-cris/std.dev sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms Cherrypick from FSF 2006-04-20 20:05:52 UTC Elena Zannoni 'import of readlilne 5.1': readline/examples/rlfe/ChangeLog readline/examples/rlfe/Makefile.in readline/examples/rlfe/README readline/examples/rlfe/config.h.in readline/examples/rlfe/configure readline/examples/rlfe/configure.in readline/examples/rlfe/extern.h readline/examples/rlfe/os.h readline/examples/rlfe/pty.c readline/examples/rlfe/rlfe.c readline/examples/rlfe/screen.h Delete: contrib/ChangeLog contrib/texi2pod.pl --- ChangeLog | 26 + Makefile.def | 6 + Makefile.in | 2506 +++++++++- Makefile.tpl | 7 +- bfd/ChangeLog | 175 +- bfd/Makefile.am | 78 +- bfd/Makefile.in | 79 +- bfd/config.bfd | 4 + bfd/configure | 21 +- bfd/configure.in | 13 +- bfd/doc/ChangeLog | 8 +- bfd/doc/Makefile.am | 25 + bfd/doc/Makefile.in | 23 + bfd/elf32-bfin.c | 22 +- bfd/elf32-i386.c | 39 +- bfd/elf32-m32c.c | 16 + bfd/elf32-sparc.c | 66 + bfd/elf32-xtensa.c | 42 +- bfd/elf64-hppa.c | 66 +- bfd/elfcode.h | 13 +- bfd/elflink.c | 47 + bfd/elfxx-ia64.c | 649 ++- bfd/elfxx-sparc.c | 440 +- bfd/elfxx-sparc.h | 11 + bfd/po/Make-in | 3 +- bfd/po/SRC-POTFILES.in | 2 + bfd/targets.c | 2 + bfd/version.h | 2 +- bfd/warning.m4 | 4 +- configure | 375 +- configure.in | 41 +- contrib/ChangeLog | 7 - contrib/texi2pod.pl | 431 -- cpu/ChangeLog | 14 + cpu/m32c.opc | 51 +- etc/ChangeLog | 8 + etc/Makefile.in | 17 + etc/configure | 2278 +++++++-- etc/configure.in | 5 + etc/configure.texi | 4 +- gdb/ChangeLog | 406 ++ gdb/MAINTAINERS | 1 + gdb/Makefile.in | 89 +- gdb/alpha-tdep.c | 6 +- gdb/arm-linux-tdep.c | 4 +- gdb/arm-tdep.c | 18 +- gdb/breakpoint.c | 161 +- gdb/breakpoint.h | 53 +- gdb/cli/cli-script.c | 11 + gdb/config/i386/nm-i386.h | 21 +- gdb/config/pa/linux.mh | 4 +- gdb/config/sparc/linux.mh | 2 +- gdb/config/sparc/linux64.mh | 2 +- gdb/corelow.c | 4 +- gdb/cris-tdep.c | 35 +- gdb/doc/ChangeLog | 20 + gdb/doc/gdb.texinfo | 15 +- gdb/doc/gdbint.texinfo | 63 +- gdb/dwarf2-frame.c | 16 +- gdb/dwarf2-frame.h | 3 +- gdb/exec.c | 4 +- gdb/frame.h | 6 + gdb/gdbarch.c | 16 +- gdb/gdbarch.h | 13 +- gdb/gdbarch.sh | 5 +- gdb/hppa-linux-tdep.c | 111 + gdb/hppa-tdep.c | 19 +- gdb/i386-nat.c | 14 +- gdb/i386-stub.c | 2 +- gdb/ia64-tdep.c | 11 +- gdb/infrun.c | 6 + gdb/linux-nat.c | 12 +- gdb/linux-nat.h | 2 + gdb/linux-thread-db.c | 77 +- gdb/m32r-rom.c | 11 + gdb/m32r-stub.c | 2 +- gdb/m32r-tdep.c | 10 +- gdb/m68k-stub.c | 2 +- gdb/m68klinux-tdep.c | 2 +- gdb/mem-break.c | 47 +- gdb/mips-tdep.c | 9 +- gdb/monitor.c | 14 +- gdb/nto-procfs.c | 22 +- gdb/ocd.c | 19 +- gdb/ocd.h | 4 +- gdb/ppc-linux-tdep.c | 6 +- gdb/ppc-tdep.h | 3 +- gdb/procfs.c | 18 +- gdb/remote-e7000.c | 12 +- gdb/remote-m32r-sdi.c | 18 +- gdb/remote-mips.c | 21 +- gdb/remote-rdp.c | 17 +- gdb/remote-sds.c | 14 +- gdb/remote-sim.c | 16 +- gdb/remote-st.c | 11 +- gdb/remote.c | 518 +- gdb/remote.h | 9 +- gdb/rs6000-nat.c | 6 +- gdb/rs6000-tdep.c | 27 +- gdb/s390-tdep.c | 979 +--- gdb/serial.c | 7 +- gdb/sh-stub.c | 2 +- gdb/sh-tdep.c | 54 + gdb/sh-tdep.h | 1 + gdb/sol-thread.c | 2 +- gdb/solib-irix.c | 18 +- gdb/sparc-linux-nat.c | 31 + gdb/sparc-linux-tdep.c | 114 +- gdb/sparc-stub.c | 2 +- gdb/sparc-tdep.c | 91 +- gdb/sparc64-linux-nat.c | 29 + gdb/sparc64-linux-tdep.c | 106 +- gdb/sparc64-tdep.c | 3 +- gdb/stack.c | 4 +- gdb/target.c | 36 +- gdb/target.h | 46 +- gdb/testsuite/ChangeLog | 17 + gdb/testsuite/gdb.base/commands.exp | 59 +- gdb/testsuite/gdb.base/float.exp | 2 + gdb/testsuite/gdb.mi/mi-until.exp | 3 + gdb/testsuite/gdb.mi/mi2-until.exp | 3 + gdb/tracepoint.c | 52 +- gdb/value.c | 39 +- gdb/value.h | 1 + gdb/version.in | 2 +- gdb/win32-nat.c | 20 +- gdb/wince.c | 16 +- include/ChangeLog | 9 + include/bfdlink.h | 9 +- include/libiberty.h | 41 + include/opcode/ChangeLog | 4 + include/opcode/avr.h | 27 +- libiberty/ChangeLog | 44 + libiberty/Makefile.in | 59 +- libiberty/configure | 9 +- libiberty/configure.ac | 5 + libiberty/functions.texi | 81 +- libiberty/pex-common.c | 196 +- libiberty/pex-common.h | 7 + libiberty/pex-djgpp.c | 1 + libiberty/pex-msdos.c | 1 + libiberty/pex-unix.c | 11 + libiberty/pex-win32.c | 594 ++- libiberty/pexecute.txh | 62 + libiberty/testsuite/Makefile.in | 4 +- opcodes/ChangeLog | 39 + opcodes/Makefile.am | 39 +- opcodes/Makefile.in | 39 +- opcodes/avr-dis.c | 7 +- opcodes/configure | 4 +- opcodes/m32c-asm.c | 51 +- opcodes/pdp11-opc.c | 4 +- opcodes/po/Make-in | 3 +- opcodes/po/POTFILES.in | 7 + opcodes/po/vi.po | 120 +- readline/ChangeLog.gdb | 9 +- readline/NEWS | 32 + readline/configure | 4 + readline/doc/ChangeLog.gdb | 4 + readline/doc/fdl.texi | 452 ++ readline/doc/history.pdf | Bin 0 -> 166940 bytes readline/doc/history.texi | 104 + readline/doc/hstech.texi | 573 +++ readline/doc/hsuser.texi | 457 ++ readline/doc/readline.pdf | Bin 0 -> 311657 bytes readline/doc/rlman.texi | 101 + readline/doc/rltech.texi | 2285 +++++++++ readline/doc/rluser.texi | 1846 +++++++ readline/doc/rluserman.pdf | Bin 0 -> 172521 bytes readline/doc/rluserman.texi | 88 + readline/doc/version.texi | 10 + readline/examples/rl-fgets.c | 374 ++ readline/examples/rlfe/ChangeLog | 37 + readline/examples/rlfe/Makefile.in | 176 + readline/examples/rlfe/README | 78 + readline/examples/rlfe/config.h.in | 375 ++ readline/examples/rlfe/configure | 5400 +++++++++++++++++++++ readline/examples/rlfe/configure.in | 438 ++ readline/examples/rlfe/extern.h | 33 + readline/examples/rlfe/os.h | 530 ++ readline/examples/rlfe/pty.c | 387 ++ readline/examples/rlfe/rlfe.c | 780 +++ readline/examples/rlfe/screen.h | 2 + readline/examples/rlptytest.c | 337 ++ readline/support/config.rpath | 548 +++ readline/support/mkinstalldirs | 111 + sim/ChangeLog | 41 + sim/cris/Makefile.in | 25 +- sim/cris/configure | 330 ++ sim/cris/configure.ac | 5 + sim/cris/cris-sim.h | 10 +- sim/cris/cris-tmpl.c | 15 + sim/cris/crisv10f.c | 61 +- sim/cris/crisv32f.c | 72 +- sim/cris/devices.c | 27 +- sim/cris/dv-cris.c | 314 ++ sim/cris/dv-rv.c | 1221 +++++ sim/cris/rvdummy.c | 536 ++ sim/cris/sim-if.c | 12 +- sim/cris/sim-main.h | 11 +- sim/d10v/ChangeLog | 4 + sim/d10v/interp.c | 2 +- sim/mips/ChangeLog | 5 + sim/mips/dv-tx3904tmr.c | 1 + sim/testsuite/ChangeLog | 18 + sim/testsuite/sim/cris/asm/testutils.inc | 18 +- sim/testsuite/sim/cris/asm/x0-v10.ms | 4 +- sim/testsuite/sim/cris/asm/x0-v32.ms | 4 +- sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms | 8 + sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms | 69 + sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms | 44 + sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms | 46 + sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms | 46 + sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms | 46 + sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms | 99 + sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms | 88 + sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms | 100 + sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms | 104 + sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms | 22 + sim/testsuite/sim/cris/hw/rv-n-cris/quit.s | 4 + sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp | 241 + sim/testsuite/sim/cris/hw/rv-n-cris/std.dev | 8 + sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc | 22 + sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms | 17 + sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms | 21 + sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms | 20 + sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms | 22 + sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r | 4 + sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms | 16 + sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms | 33 + 230 files changed, 29013 insertions(+), 3286 deletions(-) delete mode 100644 contrib/ChangeLog delete mode 100755 contrib/texi2pod.pl create mode 100644 readline/NEWS create mode 100644 readline/doc/fdl.texi create mode 100644 readline/doc/history.pdf create mode 100644 readline/doc/history.texi create mode 100644 readline/doc/hstech.texi create mode 100644 readline/doc/hsuser.texi create mode 100644 readline/doc/readline.pdf create mode 100644 readline/doc/rlman.texi create mode 100644 readline/doc/rltech.texi create mode 100644 readline/doc/rluser.texi create mode 100644 readline/doc/rluserman.pdf create mode 100644 readline/doc/rluserman.texi create mode 100644 readline/doc/version.texi create mode 100644 readline/examples/rl-fgets.c create mode 100644 readline/examples/rlfe/ChangeLog create mode 100644 readline/examples/rlfe/Makefile.in create mode 100644 readline/examples/rlfe/README create mode 100644 readline/examples/rlfe/config.h.in create mode 100755 readline/examples/rlfe/configure create mode 100644 readline/examples/rlfe/configure.in create mode 100644 readline/examples/rlfe/extern.h create mode 100644 readline/examples/rlfe/os.h create mode 100644 readline/examples/rlfe/pty.c create mode 100644 readline/examples/rlfe/rlfe.c create mode 100644 readline/examples/rlfe/screen.h create mode 100644 readline/examples/rlptytest.c create mode 100755 readline/support/config.rpath create mode 100755 readline/support/mkinstalldirs create mode 100644 sim/cris/dv-cris.c create mode 100644 sim/cris/dv-rv.c create mode 100644 sim/cris/rvdummy.c create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/quit.s create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/std.dev create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms create mode 100644 sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms diff --git a/ChangeLog b/ChangeLog index c0126cd..0312efe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2006-04-18 DJ Delorie + + * configure.in (m32c): Build libstdc++-v3. Pass flags to + reference libgloss so that libssp can be built in a combined + tree. + * configure: Regenerate. + +2006-04-10 Ben Elliston + + * contrib: Remove directory. + +2006-04-06 Carlos O'Donell + + * Makefile.tpl: Add install-html target. + * Makefile.def: Add install-html target. + * Makefile.in: Regenerate. + * configure.in: Add --with-datarootdir, --with-docdir, + and --with-htmldir options. + * configure: Regenerate. + +2006-03-31 Ben Elliston + + PR binutils/1860 + * configure.in: Require makeinfo 4.4 or higher. + * configure: Regenerate. + 2006-03-14 Paolo Bonzini * Makefile.in: Regenerate. diff --git a/Makefile.def b/Makefile.def index 3227a44..4c58ab5 100644 --- a/Makefile.def +++ b/Makefile.def @@ -155,6 +155,9 @@ recursive_targets = { make_target= TAGS; recursive_targets = { make_target= install-info; depend=configure; depend=info; }; +recursive_targets = { make_target= install-html; + depend=configure; + depend=html; }; recursive_targets = { make_target= installcheck; depend=configure; }; recursive_targets = { make_target= mostlyclean; }; @@ -172,7 +175,10 @@ flags_to_pass = { flag= bindir ; }; flags_to_pass = { flag= datadir ; }; flags_to_pass = { flag= exec_prefix ; }; flags_to_pass = { flag= includedir ; }; +flags_to_pass = { flag= datarootdir ; }; +flags_to_pass = { flag= docdir ; }; flags_to_pass = { flag= infodir ; }; +flags_to_pass = { flag= htmldir ; }; flags_to_pass = { flag= libdir ; }; flags_to_pass = { flag= libexecdir ; }; flags_to_pass = { flag= lispdir ; }; diff --git a/Makefile.in b/Makefile.in index eae74a7..2d0da2e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -50,6 +50,9 @@ libdir = @libdir@ includedir = @includedir@ oldincludedir = @oldincludedir@ infodir = @infodir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +htmldir = @htmldir@ mandir = @mandir@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 @@ -405,7 +408,10 @@ BASE_FLAGS_TO_PASS = \ "datadir=$(datadir)" \ "exec_prefix=$(exec_prefix)" \ "includedir=$(includedir)" \ + "datarootdir=$(datarootdir)" \ + "docdir=$(docdir)" \ "infodir=$(infodir)" \ + "htmldir=$(htmldir)" \ "libdir=$(libdir)" \ "libexecdir=$(libexecdir)" \ "lispdir=$(lispdir)" \ @@ -1309,6 +1315,110 @@ install-info-target: maybe-install-info-target-rda install-info-target: maybe-install-info-target-libada install-info-target: maybe-install-info-target-libgomp +.PHONY: do-install-html +do-install-html: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) install-html-host \ + install-html-target + + +.PHONY: install-html-host + +install-html-host: maybe-install-html-ash +install-html-host: maybe-install-html-autoconf +install-html-host: maybe-install-html-automake +install-html-host: maybe-install-html-bash +install-html-host: maybe-install-html-bfd +install-html-host: maybe-install-html-opcodes +install-html-host: maybe-install-html-binutils +install-html-host: maybe-install-html-bison +install-html-host: maybe-install-html-byacc +install-html-host: maybe-install-html-bzip2 +install-html-host: maybe-install-html-dejagnu +install-html-host: maybe-install-html-diff +install-html-host: maybe-install-html-dosutils +install-html-host: maybe-install-html-etc +install-html-host: maybe-install-html-fastjar +install-html-host: maybe-install-html-fileutils +install-html-host: maybe-install-html-findutils +install-html-host: maybe-install-html-find +install-html-host: maybe-install-html-fixincludes +install-html-host: maybe-install-html-flex +install-html-host: maybe-install-html-gas +install-html-host: maybe-install-html-gcc +install-html-host: maybe-install-html-gawk +install-html-host: maybe-install-html-gettext +install-html-host: maybe-install-html-gnuserv +install-html-host: maybe-install-html-gprof +install-html-host: maybe-install-html-gzip +install-html-host: maybe-install-html-hello +install-html-host: maybe-install-html-indent +install-html-host: maybe-install-html-intl +install-html-host: maybe-install-html-tcl +install-html-host: maybe-install-html-itcl +install-html-host: maybe-install-html-ld +install-html-host: maybe-install-html-libcpp +install-html-host: maybe-install-html-libdecnumber +install-html-host: maybe-install-html-libgui +install-html-host: maybe-install-html-libiberty +install-html-host: maybe-install-html-libtool +install-html-host: maybe-install-html-m4 +install-html-host: maybe-install-html-make +install-html-host: maybe-install-html-mmalloc +install-html-host: maybe-install-html-patch +install-html-host: maybe-install-html-perl +install-html-host: maybe-install-html-prms +install-html-host: maybe-install-html-rcs +install-html-host: maybe-install-html-readline +install-html-host: maybe-install-html-release +install-html-host: maybe-install-html-recode +install-html-host: maybe-install-html-sed +install-html-host: maybe-install-html-send-pr +install-html-host: maybe-install-html-shellutils +install-html-host: maybe-install-html-sid +install-html-host: maybe-install-html-sim +install-html-host: maybe-install-html-tar +install-html-host: maybe-install-html-texinfo +install-html-host: maybe-install-html-textutils +install-html-host: maybe-install-html-time +install-html-host: maybe-install-html-uudecode +install-html-host: maybe-install-html-wdiff +install-html-host: maybe-install-html-zip +install-html-host: maybe-install-html-zlib +install-html-host: maybe-install-html-gdb +install-html-host: maybe-install-html-expect +install-html-host: maybe-install-html-guile +install-html-host: maybe-install-html-tk +install-html-host: maybe-install-html-libtermcap +install-html-host: maybe-install-html-utils +install-html-host: maybe-install-html-gnattools + +.PHONY: install-html-target + +install-html-target: maybe-install-html-target-libstdc++-v3 +install-html-target: maybe-install-html-target-libmudflap +install-html-target: maybe-install-html-target-libssp +install-html-target: maybe-install-html-target-libgcc-math +install-html-target: maybe-install-html-target-newlib +install-html-target: maybe-install-html-target-libgfortran +install-html-target: maybe-install-html-target-libobjc +install-html-target: maybe-install-html-target-libtermcap +install-html-target: maybe-install-html-target-winsup +install-html-target: maybe-install-html-target-libgloss +install-html-target: maybe-install-html-target-libiberty +install-html-target: maybe-install-html-target-gperf +install-html-target: maybe-install-html-target-examples +install-html-target: maybe-install-html-target-libffi +install-html-target: maybe-install-html-target-libjava +install-html-target: maybe-install-html-target-zlib +install-html-target: maybe-install-html-target-boehm-gc +install-html-target: maybe-install-html-target-qthreads +install-html-target: maybe-install-html-target-rda +install-html-target: maybe-install-html-target-libada +install-html-target: maybe-install-html-target-libgomp + .PHONY: do-installcheck do-installcheck: @: $(MAKE); $(unstage) @@ -1832,7 +1942,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libgomp # Here are the targets which correspond to the do-X targets. -.PHONY: info installcheck dvi html install-info +.PHONY: info installcheck dvi html install-info install-html .PHONY: clean distclean mostlyclean maintainer-clean realclean .PHONY: local-clean local-distclean local-maintainer-clean info: do-info @@ -1850,6 +1960,8 @@ install-info: do-install-info dir.info $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \ else true ; fi +install-html: do-install-html + local-clean: -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log @@ -2801,6 +2913,33 @@ install-info-ash: \ @endif ash +.PHONY: maybe-install-html-ash install-html-ash +maybe-install-html-ash: +@if ash +maybe-install-html-ash: install-html-ash + +install-html-ash: \ + configure-ash \ + html-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif ash + .PHONY: maybe-installcheck-ash installcheck-ash maybe-installcheck-ash: @if ash @@ -3138,6 +3277,33 @@ install-info-autoconf: \ @endif autoconf +.PHONY: maybe-install-html-autoconf install-html-autoconf +maybe-install-html-autoconf: +@if autoconf +maybe-install-html-autoconf: install-html-autoconf + +install-html-autoconf: \ + configure-autoconf \ + html-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif autoconf + .PHONY: maybe-installcheck-autoconf installcheck-autoconf maybe-installcheck-autoconf: @if autoconf @@ -3475,6 +3641,33 @@ install-info-automake: \ @endif automake +.PHONY: maybe-install-html-automake install-html-automake +maybe-install-html-automake: +@if automake +maybe-install-html-automake: install-html-automake + +install-html-automake: \ + configure-automake \ + html-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif automake + .PHONY: maybe-installcheck-automake installcheck-automake maybe-installcheck-automake: @if automake @@ -3812,6 +4005,33 @@ install-info-bash: \ @endif bash +.PHONY: maybe-install-html-bash install-html-bash +maybe-install-html-bash: +@if bash +maybe-install-html-bash: install-html-bash + +install-html-bash: \ + configure-bash \ + html-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bash + .PHONY: maybe-installcheck-bash installcheck-bash maybe-installcheck-bash: @if bash @@ -4501,6 +4721,32 @@ install-info-bfd: \ @endif bfd +.PHONY: maybe-install-html-bfd install-html-bfd +maybe-install-html-bfd: +@if bfd +maybe-install-html-bfd: install-html-bfd + +install-html-bfd: \ + configure-bfd \ + html-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bfd + .PHONY: maybe-installcheck-bfd installcheck-bfd maybe-installcheck-bfd: @if bfd @@ -5185,6 +5431,32 @@ install-info-opcodes: \ @endif opcodes +.PHONY: maybe-install-html-opcodes install-html-opcodes +maybe-install-html-opcodes: +@if opcodes +maybe-install-html-opcodes: install-html-opcodes + +install-html-opcodes: \ + configure-opcodes \ + html-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif opcodes + .PHONY: maybe-installcheck-opcodes installcheck-opcodes maybe-installcheck-opcodes: @if opcodes @@ -5869,6 +6141,32 @@ install-info-binutils: \ @endif binutils +.PHONY: maybe-install-html-binutils install-html-binutils +maybe-install-html-binutils: +@if binutils +maybe-install-html-binutils: install-html-binutils + +install-html-binutils: \ + configure-binutils \ + html-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif binutils + .PHONY: maybe-installcheck-binutils installcheck-binutils maybe-installcheck-binutils: @if binutils @@ -6204,6 +6502,33 @@ install-info-bison: \ @endif bison +.PHONY: maybe-install-html-bison install-html-bison +maybe-install-html-bison: +@if bison +maybe-install-html-bison: install-html-bison + +install-html-bison: \ + configure-bison \ + html-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bison + .PHONY: maybe-installcheck-bison installcheck-bison maybe-installcheck-bison: @if bison @@ -6544,6 +6869,33 @@ install-info-byacc: \ @endif byacc +.PHONY: maybe-install-html-byacc install-html-byacc +maybe-install-html-byacc: +@if byacc +maybe-install-html-byacc: install-html-byacc + +install-html-byacc: \ + configure-byacc \ + html-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif byacc + .PHONY: maybe-installcheck-byacc installcheck-byacc maybe-installcheck-byacc: @if byacc @@ -6881,6 +7233,33 @@ install-info-bzip2: \ @endif bzip2 +.PHONY: maybe-install-html-bzip2 install-html-bzip2 +maybe-install-html-bzip2: +@if bzip2 +maybe-install-html-bzip2: install-html-bzip2 + +install-html-bzip2: \ + configure-bzip2 \ + html-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bzip2 + .PHONY: maybe-installcheck-bzip2 installcheck-bzip2 maybe-installcheck-bzip2: @if bzip2 @@ -7218,6 +7597,33 @@ install-info-dejagnu: \ @endif dejagnu +.PHONY: maybe-install-html-dejagnu install-html-dejagnu +maybe-install-html-dejagnu: +@if dejagnu +maybe-install-html-dejagnu: install-html-dejagnu + +install-html-dejagnu: \ + configure-dejagnu \ + html-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif dejagnu + .PHONY: maybe-installcheck-dejagnu installcheck-dejagnu maybe-installcheck-dejagnu: @if dejagnu @@ -7555,6 +7961,33 @@ install-info-diff: \ @endif diff +.PHONY: maybe-install-html-diff install-html-diff +maybe-install-html-diff: +@if diff +maybe-install-html-diff: install-html-diff + +install-html-diff: \ + configure-diff \ + html-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif diff + .PHONY: maybe-installcheck-diff installcheck-diff maybe-installcheck-diff: @if diff @@ -7886,6 +8319,33 @@ install-info-dosutils: \ @endif dosutils +.PHONY: maybe-install-html-dosutils install-html-dosutils +maybe-install-html-dosutils: +@if dosutils +maybe-install-html-dosutils: install-html-dosutils + +install-html-dosutils: \ + configure-dosutils \ + html-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif dosutils + .PHONY: maybe-installcheck-dosutils installcheck-dosutils maybe-installcheck-dosutils: @if dosutils @@ -8223,6 +8683,33 @@ install-info-etc: \ @endif etc +.PHONY: maybe-install-html-etc install-html-etc +maybe-install-html-etc: +@if etc +maybe-install-html-etc: install-html-etc + +install-html-etc: \ + configure-etc \ + html-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif etc + .PHONY: maybe-installcheck-etc installcheck-etc maybe-installcheck-etc: @if etc @@ -8563,6 +9050,33 @@ install-info-fastjar: \ @endif fastjar +.PHONY: maybe-install-html-fastjar install-html-fastjar +maybe-install-html-fastjar: +@if fastjar +maybe-install-html-fastjar: install-html-fastjar + +install-html-fastjar: \ + configure-fastjar \ + html-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif fastjar + .PHONY: maybe-installcheck-fastjar installcheck-fastjar maybe-installcheck-fastjar: @if fastjar @@ -8900,6 +9414,33 @@ install-info-fileutils: \ @endif fileutils +.PHONY: maybe-install-html-fileutils install-html-fileutils +maybe-install-html-fileutils: +@if fileutils +maybe-install-html-fileutils: install-html-fileutils + +install-html-fileutils: \ + configure-fileutils \ + html-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif fileutils + .PHONY: maybe-installcheck-fileutils installcheck-fileutils maybe-installcheck-fileutils: @if fileutils @@ -9237,6 +9778,33 @@ install-info-findutils: \ @endif findutils +.PHONY: maybe-install-html-findutils install-html-findutils +maybe-install-html-findutils: +@if findutils +maybe-install-html-findutils: install-html-findutils + +install-html-findutils: \ + configure-findutils \ + html-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif findutils + .PHONY: maybe-installcheck-findutils installcheck-findutils maybe-installcheck-findutils: @if findutils @@ -9574,6 +10142,33 @@ install-info-find: \ @endif find +.PHONY: maybe-install-html-find install-html-find +maybe-install-html-find: +@if find +maybe-install-html-find: install-html-find + +install-html-find: \ + configure-find \ + html-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif find + .PHONY: maybe-installcheck-find installcheck-find maybe-installcheck-find: @if find @@ -9846,6 +10441,33 @@ install-info-fixincludes: @endif fixincludes +.PHONY: maybe-install-html-fixincludes install-html-fixincludes +maybe-install-html-fixincludes: +@if fixincludes +maybe-install-html-fixincludes: install-html-fixincludes + +install-html-fixincludes: \ + configure-fixincludes \ + html-fixincludes + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif fixincludes + .PHONY: maybe-installcheck-fixincludes installcheck-fixincludes maybe-installcheck-fixincludes: @if fixincludes @@ -10170,6 +10792,33 @@ install-info-flex: \ @endif flex +.PHONY: maybe-install-html-flex install-html-flex +maybe-install-html-flex: +@if flex +maybe-install-html-flex: install-html-flex + +install-html-flex: \ + configure-flex \ + html-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif flex + .PHONY: maybe-installcheck-flex installcheck-flex maybe-installcheck-flex: @if flex @@ -10859,6 +11508,32 @@ install-info-gas: \ @endif gas +.PHONY: maybe-install-html-gas install-html-gas +maybe-install-html-gas: +@if gas +maybe-install-html-gas: install-html-gas + +install-html-gas: \ + configure-gas \ + html-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gas + .PHONY: maybe-installcheck-gas installcheck-gas maybe-installcheck-gas: @if gas @@ -11543,6 +12218,32 @@ install-info-gcc: \ @endif gcc +.PHONY: maybe-install-html-gcc install-html-gcc +maybe-install-html-gcc: +@if gcc +maybe-install-html-gcc: install-html-gcc + +install-html-gcc: \ + configure-gcc \ + html-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gcc + .PHONY: maybe-installcheck-gcc installcheck-gcc maybe-installcheck-gcc: @if gcc @@ -11875,6 +12576,33 @@ install-info-gawk: \ @endif gawk +.PHONY: maybe-install-html-gawk install-html-gawk +maybe-install-html-gawk: +@if gawk +maybe-install-html-gawk: install-html-gawk + +install-html-gawk: \ + configure-gawk \ + html-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gawk + .PHONY: maybe-installcheck-gawk installcheck-gawk maybe-installcheck-gawk: @if gawk @@ -12212,6 +12940,33 @@ install-info-gettext: \ @endif gettext +.PHONY: maybe-install-html-gettext install-html-gettext +maybe-install-html-gettext: +@if gettext +maybe-install-html-gettext: install-html-gettext + +install-html-gettext: \ + configure-gettext \ + html-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gettext + .PHONY: maybe-installcheck-gettext installcheck-gettext maybe-installcheck-gettext: @if gettext @@ -12549,6 +13304,33 @@ install-info-gnuserv: \ @endif gnuserv +.PHONY: maybe-install-html-gnuserv install-html-gnuserv +maybe-install-html-gnuserv: +@if gnuserv +maybe-install-html-gnuserv: install-html-gnuserv + +install-html-gnuserv: \ + configure-gnuserv \ + html-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gnuserv + .PHONY: maybe-installcheck-gnuserv installcheck-gnuserv maybe-installcheck-gnuserv: @if gnuserv @@ -12886,6 +13668,33 @@ install-info-gprof: \ @endif gprof +.PHONY: maybe-install-html-gprof install-html-gprof +maybe-install-html-gprof: +@if gprof +maybe-install-html-gprof: install-html-gprof + +install-html-gprof: \ + configure-gprof \ + html-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gprof + .PHONY: maybe-installcheck-gprof installcheck-gprof maybe-installcheck-gprof: @if gprof @@ -13223,6 +14032,33 @@ install-info-gzip: \ @endif gzip +.PHONY: maybe-install-html-gzip install-html-gzip +maybe-install-html-gzip: +@if gzip +maybe-install-html-gzip: install-html-gzip + +install-html-gzip: \ + configure-gzip \ + html-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gzip + .PHONY: maybe-installcheck-gzip installcheck-gzip maybe-installcheck-gzip: @if gzip @@ -13560,6 +14396,33 @@ install-info-hello: \ @endif hello +.PHONY: maybe-install-html-hello install-html-hello +maybe-install-html-hello: +@if hello +maybe-install-html-hello: install-html-hello + +install-html-hello: \ + configure-hello \ + html-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif hello + .PHONY: maybe-installcheck-hello installcheck-hello maybe-installcheck-hello: @if hello @@ -13897,6 +14760,33 @@ install-info-indent: \ @endif indent +.PHONY: maybe-install-html-indent install-html-indent +maybe-install-html-indent: +@if indent +maybe-install-html-indent: install-html-indent + +install-html-indent: \ + configure-indent \ + html-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif indent + .PHONY: maybe-installcheck-indent installcheck-indent maybe-installcheck-indent: @if indent @@ -14586,6 +15476,32 @@ install-info-intl: \ @endif intl +.PHONY: maybe-install-html-intl install-html-intl +maybe-install-html-intl: +@if intl +maybe-install-html-intl: install-html-intl + +install-html-intl: \ + configure-intl \ + html-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif intl + .PHONY: maybe-installcheck-intl installcheck-intl maybe-installcheck-intl: @if intl @@ -14918,6 +15834,33 @@ install-info-tcl: \ @endif tcl +.PHONY: maybe-install-html-tcl install-html-tcl +maybe-install-html-tcl: +@if tcl +maybe-install-html-tcl: install-html-tcl + +install-html-tcl: \ + configure-tcl \ + html-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif tcl + .PHONY: maybe-installcheck-tcl installcheck-tcl maybe-installcheck-tcl: @if tcl @@ -15240,6 +16183,33 @@ install-info-itcl: \ @endif itcl +.PHONY: maybe-install-html-itcl install-html-itcl +maybe-install-html-itcl: +@if itcl +maybe-install-html-itcl: install-html-itcl + +install-html-itcl: \ + configure-itcl \ + html-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif itcl + .PHONY: maybe-installcheck-itcl installcheck-itcl maybe-installcheck-itcl: @if itcl @@ -15929,6 +16899,32 @@ install-info-ld: \ @endif ld +.PHONY: maybe-install-html-ld install-html-ld +maybe-install-html-ld: +@if ld +maybe-install-html-ld: install-html-ld + +install-html-ld: \ + configure-ld \ + html-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif ld + .PHONY: maybe-installcheck-ld installcheck-ld maybe-installcheck-ld: @if ld @@ -16613,6 +17609,32 @@ install-info-libcpp: \ @endif libcpp +.PHONY: maybe-install-html-libcpp install-html-libcpp +maybe-install-html-libcpp: +@if libcpp +maybe-install-html-libcpp: install-html-libcpp + +install-html-libcpp: \ + configure-libcpp \ + html-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libcpp + .PHONY: maybe-installcheck-libcpp installcheck-libcpp maybe-installcheck-libcpp: @if libcpp @@ -17297,6 +18319,32 @@ install-info-libdecnumber: \ @endif libdecnumber +.PHONY: maybe-install-html-libdecnumber install-html-libdecnumber +maybe-install-html-libdecnumber: +@if libdecnumber +maybe-install-html-libdecnumber: install-html-libdecnumber + +install-html-libdecnumber: \ + configure-libdecnumber \ + html-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libdecnumber + .PHONY: maybe-installcheck-libdecnumber installcheck-libdecnumber maybe-installcheck-libdecnumber: @if libdecnumber @@ -17629,6 +18677,33 @@ install-info-libgui: \ @endif libgui +.PHONY: maybe-install-html-libgui install-html-libgui +maybe-install-html-libgui: +@if libgui +maybe-install-html-libgui: install-html-libgui + +install-html-libgui: \ + configure-libgui \ + html-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libgui + .PHONY: maybe-installcheck-libgui installcheck-libgui maybe-installcheck-libgui: @if libgui @@ -18318,6 +19393,32 @@ install-info-libiberty: \ @endif libiberty +.PHONY: maybe-install-html-libiberty install-html-libiberty +maybe-install-html-libiberty: +@if libiberty +maybe-install-html-libiberty: install-html-libiberty + +install-html-libiberty: \ + configure-libiberty \ + html-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libiberty + .PHONY: maybe-installcheck-libiberty installcheck-libiberty maybe-installcheck-libiberty: @if libiberty @@ -18650,6 +19751,33 @@ install-info-libtool: \ @endif libtool +.PHONY: maybe-install-html-libtool install-html-libtool +maybe-install-html-libtool: +@if libtool +maybe-install-html-libtool: install-html-libtool + +install-html-libtool: \ + configure-libtool \ + html-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libtool + .PHONY: maybe-installcheck-libtool installcheck-libtool maybe-installcheck-libtool: @if libtool @@ -18987,6 +20115,33 @@ install-info-m4: \ @endif m4 +.PHONY: maybe-install-html-m4 install-html-m4 +maybe-install-html-m4: +@if m4 +maybe-install-html-m4: install-html-m4 + +install-html-m4: \ + configure-m4 \ + html-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif m4 + .PHONY: maybe-installcheck-m4 installcheck-m4 maybe-installcheck-m4: @if m4 @@ -19324,6 +20479,33 @@ install-info-make: \ @endif make +.PHONY: maybe-install-html-make install-html-make +maybe-install-html-make: +@if make +maybe-install-html-make: install-html-make + +install-html-make: \ + configure-make \ + html-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif make + .PHONY: maybe-installcheck-make installcheck-make maybe-installcheck-make: @if make @@ -19655,6 +20837,33 @@ install-info-mmalloc: \ @endif mmalloc +.PHONY: maybe-install-html-mmalloc install-html-mmalloc +maybe-install-html-mmalloc: +@if mmalloc +maybe-install-html-mmalloc: install-html-mmalloc + +install-html-mmalloc: \ + configure-mmalloc \ + html-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif mmalloc + .PHONY: maybe-installcheck-mmalloc installcheck-mmalloc maybe-installcheck-mmalloc: @if mmalloc @@ -19992,6 +21201,33 @@ install-info-patch: \ @endif patch +.PHONY: maybe-install-html-patch install-html-patch +maybe-install-html-patch: +@if patch +maybe-install-html-patch: install-html-patch + +install-html-patch: \ + configure-patch \ + html-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif patch + .PHONY: maybe-installcheck-patch installcheck-patch maybe-installcheck-patch: @if patch @@ -20329,6 +21565,33 @@ install-info-perl: \ @endif perl +.PHONY: maybe-install-html-perl install-html-perl +maybe-install-html-perl: +@if perl +maybe-install-html-perl: install-html-perl + +install-html-perl: \ + configure-perl \ + html-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif perl + .PHONY: maybe-installcheck-perl installcheck-perl maybe-installcheck-perl: @if perl @@ -20666,6 +21929,33 @@ install-info-prms: \ @endif prms +.PHONY: maybe-install-html-prms install-html-prms +maybe-install-html-prms: +@if prms +maybe-install-html-prms: install-html-prms + +install-html-prms: \ + configure-prms \ + html-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif prms + .PHONY: maybe-installcheck-prms installcheck-prms maybe-installcheck-prms: @if prms @@ -21003,6 +22293,33 @@ install-info-rcs: \ @endif rcs +.PHONY: maybe-install-html-rcs install-html-rcs +maybe-install-html-rcs: +@if rcs +maybe-install-html-rcs: install-html-rcs + +install-html-rcs: \ + configure-rcs \ + html-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif rcs + .PHONY: maybe-installcheck-rcs installcheck-rcs maybe-installcheck-rcs: @if rcs @@ -21340,6 +22657,33 @@ install-info-readline: \ @endif readline +.PHONY: maybe-install-html-readline install-html-readline +maybe-install-html-readline: +@if readline +maybe-install-html-readline: install-html-readline + +install-html-readline: \ + configure-readline \ + html-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif readline + .PHONY: maybe-installcheck-readline installcheck-readline maybe-installcheck-readline: @if readline @@ -21665,6 +23009,33 @@ install-info-release: \ @endif release +.PHONY: maybe-install-html-release install-html-release +maybe-install-html-release: +@if release +maybe-install-html-release: install-html-release + +install-html-release: \ + configure-release \ + html-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif release + .PHONY: maybe-installcheck-release installcheck-release maybe-installcheck-release: @if release @@ -22002,6 +23373,33 @@ install-info-recode: \ @endif recode +.PHONY: maybe-install-html-recode install-html-recode +maybe-install-html-recode: +@if recode +maybe-install-html-recode: install-html-recode + +install-html-recode: \ + configure-recode \ + html-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif recode + .PHONY: maybe-installcheck-recode installcheck-recode maybe-installcheck-recode: @if recode @@ -22339,6 +23737,33 @@ install-info-sed: \ @endif sed +.PHONY: maybe-install-html-sed install-html-sed +maybe-install-html-sed: +@if sed +maybe-install-html-sed: install-html-sed + +install-html-sed: \ + configure-sed \ + html-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif sed + .PHONY: maybe-installcheck-sed installcheck-sed maybe-installcheck-sed: @if sed @@ -22676,6 +24101,33 @@ install-info-send-pr: \ @endif send-pr +.PHONY: maybe-install-html-send-pr install-html-send-pr +maybe-install-html-send-pr: +@if send-pr +maybe-install-html-send-pr: install-html-send-pr + +install-html-send-pr: \ + configure-send-pr \ + html-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif send-pr + .PHONY: maybe-installcheck-send-pr installcheck-send-pr maybe-installcheck-send-pr: @if send-pr @@ -23013,6 +24465,33 @@ install-info-shellutils: \ @endif shellutils +.PHONY: maybe-install-html-shellutils install-html-shellutils +maybe-install-html-shellutils: +@if shellutils +maybe-install-html-shellutils: install-html-shellutils + +install-html-shellutils: \ + configure-shellutils \ + html-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif shellutils + .PHONY: maybe-installcheck-shellutils installcheck-shellutils maybe-installcheck-shellutils: @if shellutils @@ -23350,6 +24829,33 @@ install-info-sid: \ @endif sid +.PHONY: maybe-install-html-sid install-html-sid +maybe-install-html-sid: +@if sid +maybe-install-html-sid: install-html-sid + +install-html-sid: \ + configure-sid \ + html-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif sid + .PHONY: maybe-installcheck-sid installcheck-sid maybe-installcheck-sid: @if sid @@ -23687,6 +25193,33 @@ install-info-sim: \ @endif sim +.PHONY: maybe-install-html-sim install-html-sim +maybe-install-html-sim: +@if sim +maybe-install-html-sim: install-html-sim + +install-html-sim: \ + configure-sim \ + html-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif sim + .PHONY: maybe-installcheck-sim installcheck-sim maybe-installcheck-sim: @if sim @@ -24024,6 +25557,33 @@ install-info-tar: \ @endif tar +.PHONY: maybe-install-html-tar install-html-tar +maybe-install-html-tar: +@if tar +maybe-install-html-tar: install-html-tar + +install-html-tar: \ + configure-tar \ + html-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif tar + .PHONY: maybe-installcheck-tar installcheck-tar maybe-installcheck-tar: @if tar @@ -24355,6 +25915,33 @@ install-info-texinfo: \ @endif texinfo +.PHONY: maybe-install-html-texinfo install-html-texinfo +maybe-install-html-texinfo: +@if texinfo +maybe-install-html-texinfo: install-html-texinfo + +install-html-texinfo: \ + configure-texinfo \ + html-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif texinfo + .PHONY: maybe-installcheck-texinfo installcheck-texinfo maybe-installcheck-texinfo: @if texinfo @@ -24692,6 +26279,33 @@ install-info-textutils: \ @endif textutils +.PHONY: maybe-install-html-textutils install-html-textutils +maybe-install-html-textutils: +@if textutils +maybe-install-html-textutils: install-html-textutils + +install-html-textutils: \ + configure-textutils \ + html-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif textutils + .PHONY: maybe-installcheck-textutils installcheck-textutils maybe-installcheck-textutils: @if textutils @@ -25029,6 +26643,33 @@ install-info-time: \ @endif time +.PHONY: maybe-install-html-time install-html-time +maybe-install-html-time: +@if time +maybe-install-html-time: install-html-time + +install-html-time: \ + configure-time \ + html-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif time + .PHONY: maybe-installcheck-time installcheck-time maybe-installcheck-time: @if time @@ -25366,6 +27007,33 @@ install-info-uudecode: \ @endif uudecode +.PHONY: maybe-install-html-uudecode install-html-uudecode +maybe-install-html-uudecode: +@if uudecode +maybe-install-html-uudecode: install-html-uudecode + +install-html-uudecode: \ + configure-uudecode \ + html-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif uudecode + .PHONY: maybe-installcheck-uudecode installcheck-uudecode maybe-installcheck-uudecode: @if uudecode @@ -25703,6 +27371,33 @@ install-info-wdiff: \ @endif wdiff +.PHONY: maybe-install-html-wdiff install-html-wdiff +maybe-install-html-wdiff: +@if wdiff +maybe-install-html-wdiff: install-html-wdiff + +install-html-wdiff: \ + configure-wdiff \ + html-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif wdiff + .PHONY: maybe-installcheck-wdiff installcheck-wdiff maybe-installcheck-wdiff: @if wdiff @@ -26043,6 +27738,33 @@ install-info-zip: \ @endif zip +.PHONY: maybe-install-html-zip install-html-zip +maybe-install-html-zip: +@if zip +maybe-install-html-zip: install-html-zip + +install-html-zip: \ + configure-zip \ + html-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif zip + .PHONY: maybe-installcheck-zip installcheck-zip maybe-installcheck-zip: @if zip @@ -26720,6 +28442,32 @@ install-info-zlib: \ @endif zlib +.PHONY: maybe-install-html-zlib install-html-zlib +maybe-install-html-zlib: +@if zlib +maybe-install-html-zlib: install-html-zlib + +install-html-zlib: \ + configure-zlib \ + html-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif zlib + .PHONY: maybe-installcheck-zlib installcheck-zlib maybe-installcheck-zlib: @if zlib @@ -27052,6 +28800,33 @@ install-info-gdb: \ @endif gdb +.PHONY: maybe-install-html-gdb install-html-gdb +maybe-install-html-gdb: +@if gdb +maybe-install-html-gdb: install-html-gdb + +install-html-gdb: \ + configure-gdb \ + html-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gdb + .PHONY: maybe-installcheck-gdb installcheck-gdb maybe-installcheck-gdb: @if gdb @@ -27389,6 +29164,33 @@ install-info-expect: \ @endif expect +.PHONY: maybe-install-html-expect install-html-expect +maybe-install-html-expect: +@if expect +maybe-install-html-expect: install-html-expect + +install-html-expect: \ + configure-expect \ + html-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif expect + .PHONY: maybe-installcheck-expect installcheck-expect maybe-installcheck-expect: @if expect @@ -27726,6 +29528,33 @@ install-info-guile: \ @endif guile +.PHONY: maybe-install-html-guile install-html-guile +maybe-install-html-guile: +@if guile +maybe-install-html-guile: install-html-guile + +install-html-guile: \ + configure-guile \ + html-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif guile + .PHONY: maybe-installcheck-guile installcheck-guile maybe-installcheck-guile: @if guile @@ -28063,6 +29892,33 @@ install-info-tk: \ @endif tk +.PHONY: maybe-install-html-tk install-html-tk +maybe-install-html-tk: +@if tk +maybe-install-html-tk: install-html-tk + +install-html-tk: \ + configure-tk \ + html-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif tk + .PHONY: maybe-installcheck-tk installcheck-tk maybe-installcheck-tk: @if tk @@ -28394,6 +30250,33 @@ install-info-libtermcap: \ @endif libtermcap +.PHONY: maybe-install-html-libtermcap install-html-libtermcap +maybe-install-html-libtermcap: +@if libtermcap +maybe-install-html-libtermcap: install-html-libtermcap + +install-html-libtermcap: \ + configure-libtermcap \ + html-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libtermcap + .PHONY: maybe-installcheck-libtermcap installcheck-libtermcap maybe-installcheck-libtermcap: @if libtermcap @@ -28665,6 +30548,33 @@ install-info-utils: \ @endif utils +.PHONY: maybe-install-html-utils install-html-utils +maybe-install-html-utils: +@if utils +maybe-install-html-utils: install-html-utils + +install-html-utils: \ + configure-utils \ + html-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif utils + .PHONY: maybe-installcheck-utils installcheck-utils maybe-installcheck-utils: @if utils @@ -29002,6 +30912,33 @@ install-info-gnattools: \ @endif gnattools +.PHONY: maybe-install-html-gnattools install-html-gnattools +maybe-install-html-gnattools: +@if gnattools +maybe-install-html-gnattools: install-html-gnattools + +install-html-gnattools: \ + configure-gnattools \ + html-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gnattools + .PHONY: maybe-installcheck-gnattools installcheck-gnattools maybe-installcheck-gnattools: @if gnattools @@ -29361,6 +31298,33 @@ install-info-target-libstdc++-v3: \ @endif target-libstdc++-v3 +.PHONY: maybe-install-html-target-libstdc++-v3 install-html-target-libstdc++-v3 +maybe-install-html-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-install-html-target-libstdc++-v3: install-html-target-libstdc++-v3 + +install-html-target-libstdc++-v3: \ + configure-target-libstdc++-v3 \ + html-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libstdc++-v3 + .PHONY: maybe-installcheck-target-libstdc++-v3 installcheck-target-libstdc++-v3 maybe-installcheck-target-libstdc++-v3: @if target-libstdc++-v3 @@ -29715,6 +31679,33 @@ install-info-target-libmudflap: \ @endif target-libmudflap +.PHONY: maybe-install-html-target-libmudflap install-html-target-libmudflap +maybe-install-html-target-libmudflap: +@if target-libmudflap +maybe-install-html-target-libmudflap: install-html-target-libmudflap + +install-html-target-libmudflap: \ + configure-target-libmudflap \ + html-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libmudflap + .PHONY: maybe-installcheck-target-libmudflap installcheck-target-libmudflap maybe-installcheck-target-libmudflap: @if target-libmudflap @@ -30069,6 +32060,33 @@ install-info-target-libssp: \ @endif target-libssp +.PHONY: maybe-install-html-target-libssp install-html-target-libssp +maybe-install-html-target-libssp: +@if target-libssp +maybe-install-html-target-libssp: install-html-target-libssp + +install-html-target-libssp: \ + configure-target-libssp \ + html-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libssp + .PHONY: maybe-installcheck-target-libssp installcheck-target-libssp maybe-installcheck-target-libssp: @if target-libssp @@ -30423,6 +32441,33 @@ install-info-target-libgcc-math: \ @endif target-libgcc-math +.PHONY: maybe-install-html-target-libgcc-math install-html-target-libgcc-math +maybe-install-html-target-libgcc-math: +@if target-libgcc-math +maybe-install-html-target-libgcc-math: install-html-target-libgcc-math + +install-html-target-libgcc-math: \ + configure-target-libgcc-math \ + html-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgcc-math + .PHONY: maybe-installcheck-target-libgcc-math installcheck-target-libgcc-math maybe-installcheck-target-libgcc-math: @if target-libgcc-math @@ -30777,6 +32822,33 @@ install-info-target-newlib: \ @endif target-newlib +.PHONY: maybe-install-html-target-newlib install-html-target-newlib +maybe-install-html-target-newlib: +@if target-newlib +maybe-install-html-target-newlib: install-html-target-newlib + +install-html-target-newlib: \ + configure-target-newlib \ + html-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-newlib + .PHONY: maybe-installcheck-target-newlib installcheck-target-newlib maybe-installcheck-target-newlib: @if target-newlib @@ -31131,6 +33203,33 @@ install-info-target-libgfortran: \ @endif target-libgfortran +.PHONY: maybe-install-html-target-libgfortran install-html-target-libgfortran +maybe-install-html-target-libgfortran: +@if target-libgfortran +maybe-install-html-target-libgfortran: install-html-target-libgfortran + +install-html-target-libgfortran: \ + configure-target-libgfortran \ + html-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgfortran + .PHONY: maybe-installcheck-target-libgfortran installcheck-target-libgfortran maybe-installcheck-target-libgfortran: @if target-libgfortran @@ -31485,6 +33584,33 @@ install-info-target-libobjc: \ @endif target-libobjc +.PHONY: maybe-install-html-target-libobjc install-html-target-libobjc +maybe-install-html-target-libobjc: +@if target-libobjc +maybe-install-html-target-libobjc: install-html-target-libobjc + +install-html-target-libobjc: \ + configure-target-libobjc \ + html-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libobjc + .PHONY: maybe-installcheck-target-libobjc installcheck-target-libobjc maybe-installcheck-target-libobjc: @if target-libobjc @@ -31834,6 +33960,33 @@ install-info-target-libtermcap: \ @endif target-libtermcap +.PHONY: maybe-install-html-target-libtermcap install-html-target-libtermcap +maybe-install-html-target-libtermcap: +@if target-libtermcap +maybe-install-html-target-libtermcap: install-html-target-libtermcap + +install-html-target-libtermcap: \ + configure-target-libtermcap \ + html-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libtermcap + .PHONY: maybe-installcheck-target-libtermcap installcheck-target-libtermcap maybe-installcheck-target-libtermcap: @if target-libtermcap @@ -32128,6 +34281,33 @@ install-info-target-winsup: \ @endif target-winsup +.PHONY: maybe-install-html-target-winsup install-html-target-winsup +maybe-install-html-target-winsup: +@if target-winsup +maybe-install-html-target-winsup: install-html-target-winsup + +install-html-target-winsup: \ + configure-target-winsup \ + html-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-winsup + .PHONY: maybe-installcheck-target-winsup installcheck-target-winsup maybe-installcheck-target-winsup: @if target-winsup @@ -32477,6 +34657,33 @@ install-info-target-libgloss: \ @endif target-libgloss +.PHONY: maybe-install-html-target-libgloss install-html-target-libgloss +maybe-install-html-target-libgloss: +@if target-libgloss +maybe-install-html-target-libgloss: install-html-target-libgloss + +install-html-target-libgloss: \ + configure-target-libgloss \ + html-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgloss + .PHONY: maybe-installcheck-target-libgloss installcheck-target-libgloss maybe-installcheck-target-libgloss: @if target-libgloss @@ -32831,6 +35038,33 @@ install-info-target-libiberty: \ @endif target-libiberty +.PHONY: maybe-install-html-target-libiberty install-html-target-libiberty +maybe-install-html-target-libiberty: +@if target-libiberty +maybe-install-html-target-libiberty: install-html-target-libiberty + +install-html-target-libiberty: \ + configure-target-libiberty \ + html-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libiberty + .PHONY: maybe-installcheck-target-libiberty installcheck-target-libiberty maybe-installcheck-target-libiberty: @if target-libiberty @@ -33185,6 +35419,33 @@ install-info-target-gperf: \ @endif target-gperf +.PHONY: maybe-install-html-target-gperf install-html-target-gperf +maybe-install-html-target-gperf: +@if target-gperf +maybe-install-html-target-gperf: install-html-target-gperf + +install-html-target-gperf: \ + configure-target-gperf \ + html-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-gperf + .PHONY: maybe-installcheck-target-gperf installcheck-target-gperf maybe-installcheck-target-gperf: @if target-gperf @@ -33529,6 +35790,33 @@ install-info-target-examples: \ @endif target-examples +.PHONY: maybe-install-html-target-examples install-html-target-examples +maybe-install-html-target-examples: +@if target-examples +maybe-install-html-target-examples: install-html-target-examples + +install-html-target-examples: \ + configure-target-examples \ + html-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-examples + .PHONY: maybe-installcheck-target-examples installcheck-target-examples maybe-installcheck-target-examples: @if target-examples @@ -33883,6 +36171,33 @@ install-info-target-libffi: \ @endif target-libffi +.PHONY: maybe-install-html-target-libffi install-html-target-libffi +maybe-install-html-target-libffi: +@if target-libffi +maybe-install-html-target-libffi: install-html-target-libffi + +install-html-target-libffi: \ + configure-target-libffi \ + html-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libffi + .PHONY: maybe-installcheck-target-libffi installcheck-target-libffi maybe-installcheck-target-libffi: @if target-libffi @@ -34237,6 +36552,33 @@ install-info-target-libjava: \ @endif target-libjava +.PHONY: maybe-install-html-target-libjava install-html-target-libjava +maybe-install-html-target-libjava: +@if target-libjava +maybe-install-html-target-libjava: install-html-target-libjava + +install-html-target-libjava: \ + configure-target-libjava \ + html-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libjava + .PHONY: maybe-installcheck-target-libjava installcheck-target-libjava maybe-installcheck-target-libjava: @if target-libjava @@ -34591,6 +36933,33 @@ install-info-target-zlib: \ @endif target-zlib +.PHONY: maybe-install-html-target-zlib install-html-target-zlib +maybe-install-html-target-zlib: +@if target-zlib +maybe-install-html-target-zlib: install-html-target-zlib + +install-html-target-zlib: \ + configure-target-zlib \ + html-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-zlib + .PHONY: maybe-installcheck-target-zlib installcheck-target-zlib maybe-installcheck-target-zlib: @if target-zlib @@ -34945,6 +37314,33 @@ install-info-target-boehm-gc: \ @endif target-boehm-gc +.PHONY: maybe-install-html-target-boehm-gc install-html-target-boehm-gc +maybe-install-html-target-boehm-gc: +@if target-boehm-gc +maybe-install-html-target-boehm-gc: install-html-target-boehm-gc + +install-html-target-boehm-gc: \ + configure-target-boehm-gc \ + html-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-boehm-gc + .PHONY: maybe-installcheck-target-boehm-gc installcheck-target-boehm-gc maybe-installcheck-target-boehm-gc: @if target-boehm-gc @@ -35299,6 +37695,33 @@ install-info-target-qthreads: \ @endif target-qthreads +.PHONY: maybe-install-html-target-qthreads install-html-target-qthreads +maybe-install-html-target-qthreads: +@if target-qthreads +maybe-install-html-target-qthreads: install-html-target-qthreads + +install-html-target-qthreads: \ + configure-target-qthreads \ + html-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-qthreads + .PHONY: maybe-installcheck-target-qthreads installcheck-target-qthreads maybe-installcheck-target-qthreads: @if target-qthreads @@ -35653,6 +38076,33 @@ install-info-target-rda: \ @endif target-rda +.PHONY: maybe-install-html-target-rda install-html-target-rda +maybe-install-html-target-rda: +@if target-rda +maybe-install-html-target-rda: install-html-target-rda + +install-html-target-rda: \ + configure-target-rda \ + html-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-rda + .PHONY: maybe-installcheck-target-rda installcheck-target-rda maybe-installcheck-target-rda: @if target-rda @@ -36007,6 +38457,33 @@ install-info-target-libada: \ @endif target-libada +.PHONY: maybe-install-html-target-libada install-html-target-libada +maybe-install-html-target-libada: +@if target-libada +maybe-install-html-target-libada: install-html-target-libada + +install-html-target-libada: \ + configure-target-libada \ + html-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libada + .PHONY: maybe-installcheck-target-libada installcheck-target-libada maybe-installcheck-target-libada: @if target-libada @@ -36361,6 +38838,33 @@ install-info-target-libgomp: \ @endif target-libgomp +.PHONY: maybe-install-html-target-libgomp install-html-target-libgomp +maybe-install-html-target-libgomp: +@if target-libgomp +maybe-install-html-target-libgomp: install-html-target-libgomp + +install-html-target-libgomp: \ + configure-target-libgomp \ + html-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgomp + .PHONY: maybe-installcheck-target-libgomp installcheck-target-libgomp maybe-installcheck-target-libgomp: @if target-libgomp diff --git a/Makefile.tpl b/Makefile.tpl index 274474a..b83d8d5 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -53,6 +53,9 @@ libdir = @libdir@ includedir = @includedir@ oldincludedir = @oldincludedir@ infodir = @infodir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +htmldir = @htmldir@ mandir = @mandir@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 @@ -532,7 +535,7 @@ do-[+make_target+]: # Here are the targets which correspond to the do-X targets. -.PHONY: info installcheck dvi html install-info +.PHONY: info installcheck dvi html install-info install-html .PHONY: clean distclean mostlyclean maintainer-clean realclean .PHONY: local-clean local-distclean local-maintainer-clean info: do-info @@ -550,6 +553,8 @@ install-info: do-install-info dir.info $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \ else true ; fi +install-html: do-install-html + local-clean: -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 51157c0..1ea6061 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,175 @@ +2006-04-19 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + +2006-04-19 Alan Modra + + * warning.m4 (--enable-werror): Format help message. + (--enable-build-warnings): Likewise. + * configure: Regenerate. + +2006-04-18 Nick Clifton + + PR 2257 + * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx + fields to still be handled as ELF files. + +2006-04-16 Daniel Jacobowitz + + * po/SRC-POTFILES.in: Regenerated. + +2006-04-16 Daniel Jacobowitz + + * configure.in: Update version to 2.17.50. + * configure: Regenerated. + +2006-04-14 David Heine + + * elf32-xtensa.c (build_reloc_opcodes): New. + (compute_text_actions): Use it to decode opcodes outside inner loop. + (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if + it is set, use it to get the opcodes for relocations. + (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit. + +2006-04-08 H.J. Lu + + PR ld/2513 + * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type. + (GOT_TLS_IE_IE): Likewise. + (GOT_TLS_IE_GD): Likewise. + (GOT_TLS_IE_MASK): Likewise. + (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD + and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE + respectively. + (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD + are set, treat tls_type as GOT_TLS_IE_BOTH. + (elf_i386_relocate_section): Likewise. + +2006-04-07 Randolph Chung + + * elf64-hppa.c (elf64_hppa_grok_prstatus): New function. + (elf64_hppa_grok_psinfo): Likewise. + (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define. + +2006-04-06 DJ Delorie + + * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for + each plt entry we create. + +2006-04-06 Carlos O'Donell + + * po/Make-in: Add install-html target. + * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir + htmldir. Add install-html and install-html-recursive targets. + * Makefile.in: Regenerate. + * configure.in: AC_SUBST for datarootdir, docdir and htmldir. + * configure: Regenerate. + +2006-04-06 H.J. Lu + + * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes + with the skip_relax_pass_0 and skip_relax_pass_1 bits in the + section structure. + +2006-04-05 Bernd Schmidt + + * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to + eliminate warnings. + +2006-04-05 H.J. Lu + James E Wilson + + PR ld/2442 + * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next. + (elfNN_ia64_local_hash_entry): Add count, sorted_count and + size. + (elfNN_ia64_link_hash_entry): Likewise. + (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count + and size. + (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info + processing. + (elfNN_ia64_hash_hide_symbol): Likewise. + (elfNN_ia64_global_dyn_sym_thunk): Likewise. + (elfNN_ia64_local_dyn_sym_thunk): Likewise. + (elfNN_ia64_global_dyn_info_free): New function. + (elfNN_ia64_local_dyn_info_free): Likewise. + (elfNN_ia64_hash_table_free): Free local and global + elfNN_ia64_dyn_sym_info. + (addend_compare): New function. + (sort_dyn_sym_info): Likewise. + (get_dyn_sym_info): Updated to use binary search for addend. + (elfNN_ia64_check_relocs): Scan relocations to create dynamic + relocation arrays first. + +2006-04-05 Bernd Schmidt + + * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp + symbol. + +2006-04-05 H.J. Lu + + PR ld/2411 + * elflink.c (check_dynsym): New. + (elf_link_output_extsym): Use it. + (bfd_elf_final_link): Likewise. + +2006-04-05 H.J. Lu + + PR ld/2404 + * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect + symbol from the dynamic definition with the default version if + its type and the type of existing regular definition mismatch. + +2006-04-05 Richard Sandiford + Daniel Jacobowitz + + * config.bfd (sparc-*-vxworks*): New stanza. + * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza. + (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo. + * configure: Regenerate. + * elf32-sparc.c: Include elf-vxworks.h. + (elf32_sparc_vxworks_link_hash_table_create: New. + (elf32_sparc_vxworks_final_write_processing): New. + (TARGET_BIG_SYM): Override for VxWorks. + (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise. + (bfd_elf32_bfd_link_hash_table_create): Likewise. + (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise. + (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise. + (elf_backend_link_output_symbol_hook): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_final_write_processing, elf32_bed): Likewise. + * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h. + (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New. + (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New. + (_bfd_sparc_elf_link_hash_table_create): Don't initialize + build_plt_entry here. + (create_got_section): Initialize sgotplt for VxWorks. + (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry, + plt_header_size and plt_entry_size, with new VxWorks-specific settings. + Call elf_vxworks_create_dynamic_sections for VxWorks. + (allocate_dynrelocs): Use plt_header_size and plt_entry_size. + Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks. + (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt + for VxWorks. Check for the .got.plt section. + (sparc_vxworks_build_plt_entry): New function. + (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs. + Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_ + absolute on VxWorks. + (sparc32_finish_dyn): Add special handling for DT_RELASZ + and DT_PLTGOT on VxWorks. + (sparc_vxworks_finish_exec_plt): New. + (sparc_vxworks_finish_shared_plt): New. + (_bfd_sparc_elf_finish_dynamic_sections): Call them. + Use plt_header_size and plt_entry_size. + * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks, + srelplt2, sgotplt, plt_header_size and plt_entry_size fields. + * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h. + (elf32-sparc.lo): Likewise. + * Makefile.in: Regenerate. + * targets.c (bfd_elf32_sparc_vxworks_vec): Declare. + (_bfd_target_vector): Add a pointer to it. + 2006-03-30 Ben Elliston PR ld/2267 @@ -405,8 +577,7 @@ 2006-03-11 H.J. Lu PR ld/2443 - * dwarf2.c (concat_filename): Don't issue an error if file is - 0. + * dwarf2.c (concat_filename): Don't issue an error if file is 0. 2006-03-10 Paul Brook diff --git a/bfd/Makefile.am b/bfd/Makefile.am index a0d5edf..44a4201 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -11,10 +11,14 @@ MKDEP = gcc -MM SUBDIRS = doc po -docdir = doc +bfddocdir = doc bfdlibdir = @bfdlibdir@ bfdincludedir = @bfdincludedir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +htmldir = @htmldir@ + bfdlib_LTLIBRARIES = libbfd.la WARN_CFLAGS = @WARN_CFLAGS@ @@ -661,6 +665,35 @@ po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES) all diststuff: info +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + # Various kinds of .o files to put in libbfd.a: # BFD_BACKENDS Routines the configured targets need. # BFD_MACHINES Architecture-specific routines the configured targets need. @@ -859,12 +892,12 @@ LIBCOFF_H_FILES = libcoff-in.h coffcode.h # Could really use a "copy-if-change"... headers: - (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS)) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS)) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h - cp $(docdir)/libbfd.h libbfd.h-new + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h - cp $(docdir)/libcoff.h libcoff.h-new + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h # We only rebuild the header files automatically if we have been @@ -872,22 +905,22 @@ headers: $(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h touch stmp-bin2-h $(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true stmp-lbfd-h: $(LIBBFD_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) - cp $(docdir)/libbfd.h libbfd.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h touch stmp-lbfd-h $(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true stmp-lcoff-h: $(LIBCOFF_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) - cp $(docdir)/libcoff.h libcoff.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h touch stmp-lcoff-h @@ -1231,7 +1264,8 @@ elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \ + elf32-target.h elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \ $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \ @@ -1349,15 +1383,15 @@ elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf-vxworks.h + elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h elf-vxworks.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - ecoffswap.h elf32-target.h elf-vxworks.h + ecoffswap.h elf32-target.h elf32-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \ @@ -1413,15 +1447,15 @@ elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \ $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \ elf32-target.h elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf-vxworks.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h elf32-target.h + elfxx-sparc.h elf-vxworks.h elf32-target.h elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 6b78333..4e22167 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -2,7 +2,7 @@ # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -217,6 +217,8 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -224,6 +226,7 @@ host_cpu = @host_cpu@ host_noncanonical = @host_noncanonical@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ @@ -255,7 +258,7 @@ INCDIR = $(srcdir)/../include CSEARCH = -I. -I$(srcdir) -I$(INCDIR) MKDEP = gcc -MM SUBDIRS = doc po -docdir = doc +bfddocdir = doc bfdlib_LTLIBRARIES = libbfd.la AM_CFLAGS = $(WARN_CFLAGS) @@ -1265,6 +1268,35 @@ po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES) all diststuff: info +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + stamp-ofiles: Makefile rm -f tofiles f=""; \ @@ -1433,12 +1465,12 @@ stmp-bfd-h: bfd-in3.h # Could really use a "copy-if-change"... headers: - (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS)) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS)) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h - cp $(docdir)/libbfd.h libbfd.h-new + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h - cp $(docdir)/libcoff.h libcoff.h-new + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h # We only rebuild the header files automatically if we have been @@ -1446,22 +1478,22 @@ headers: $(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h touch stmp-bin2-h $(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true stmp-lbfd-h: $(LIBBFD_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) - cp $(docdir)/libbfd.h libbfd.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h touch stmp-lbfd-h $(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true stmp-lcoff-h: $(LIBCOFF_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) - cp $(docdir)/libcoff.h libcoff.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h touch stmp-lcoff-h @@ -1798,7 +1830,8 @@ elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \ + elf32-target.h elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \ $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \ $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \ @@ -1916,15 +1949,15 @@ elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf-vxworks.h + elf-vxworks.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h elf-vxworks.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - ecoffswap.h elf32-target.h elf-vxworks.h + ecoffswap.h elf32-target.h elf32-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \ @@ -1980,15 +2013,15 @@ elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \ $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \ elf32-target.h elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf-vxworks.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elfxx-sparc.h elf32-target.h + elfxx-sparc.h elf-vxworks.h elf32-target.h elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h \ diff --git a/bfd/config.bfd b/bfd/config.bfd index ccd0de8..4fd72c1 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -1284,6 +1284,10 @@ case "${targ}" in sparc-*-sysv4*) targ_defvec=bfd_elf32_sparc_vec ;; + sparc-*-vxworks*) + targ_defvec=bfd_elf32_sparc_vxworks_vec + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + ;; sparc-*-netware*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs="nlm32_sparc_vec sunos_big_vec" diff --git a/bfd/configure b/bfd/configure index 5ad2bc4..ffe2556 100755 --- a/bfd/configure +++ b/bfd/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LN_S LIBTOOL WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LN_S LIBTOOL WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -860,8 +860,8 @@ Optional Features: --enable-targets alternative target configurations --enable-commonbfdlib build shared BFD/opcodes/libiberty library --enable-secureplt Default to creating read-only plt entries - --enable-werror treat compile warnings as errors - --enable-build-warnings Enable build-time compiler warnings + --enable-werror treat compile warnings as errors + --enable-build-warnings enable build-time compiler warnings --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-install-libbfd controls installation of libbfd and related headers @@ -2836,7 +2836,7 @@ fi # Define the identity of the package. PACKAGE=bfd - VERSION=2.16.91 + VERSION=2.17.50 cat >>confdefs.h <<_ACEOF @@ -13159,7 +13159,8 @@ do bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf32.lo $elf" ;; + bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; @@ -13190,7 +13191,7 @@ do bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; @@ -14525,6 +14526,11 @@ rm -f doc/config.status ac_config_commands="$ac_config_commands default" + + + + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -15293,6 +15299,9 @@ s,@bfd_default_target_size@,$bfd_default_target_size,;t t s,@bfd_file_ptr@,$bfd_file_ptr,;t t s,@bfd_ufile_ptr@,$bfd_ufile_ptr,;t t s,@tdefaults@,$tdefaults,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/bfd/configure.in b/bfd/configure.in index bc8dabb..1f0d2ca 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -8,7 +8,7 @@ AC_CONFIG_SRCDIR([libbfd.c]) AC_CANONICAL_TARGET AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.16.91) +AM_INIT_AUTOMAKE(bfd, 2.17.50) dnl These must be called before AM_PROG_LIBTOOL, because it may want dnl to call AC_CHECK_PROG. @@ -672,7 +672,8 @@ do bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf32.lo $elf" ;; + bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; @@ -703,7 +704,7 @@ do bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; @@ -962,5 +963,11 @@ esac rm -f doc/config.status AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in]) AC_CONFIG_COMMANDS([default],[[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile]],[[]]) + +dnl Required by html and install-html +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + AC_OUTPUT diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog index dd9b8b0..d00fd99 100644 --- a/bfd/doc/ChangeLog +++ b/bfd/doc/ChangeLog @@ -1,4 +1,10 @@ -2006-02-27 Carlos O'Donell + + * Makefile.am: Add install-html and install-html-am targets. + Define datarootdir, docdir and htmldir. + * Makefile.in: Regenerate. + +2006-02-27 Carlos O'Donell * Makefile.am: Add html target. * Makefile.in: Regenerate. diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am index 7bee26d..6d221fa 100644 --- a/bfd/doc/Makefile.am +++ b/bfd/doc/Makefile.am @@ -287,3 +287,28 @@ MAINTAINERCLEANFILES = $(DOCFILES) # We want install to imply install-info as per GNU standards, despite the # cygnus option. install: install-info + +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + + + + diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index fa92e70..ad81061 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -181,6 +181,8 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -188,6 +190,7 @@ host_cpu = @host_cpu@ host_noncanonical = @host_noncanonical@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ @@ -313,6 +316,7 @@ MOSTLYCLEANFILES = $(MKDOC) *.o CLEANFILES = *.p *.ip DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log MAINTAINERCLEANFILES = $(DOCFILES) +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; all: all-am .SUFFIXES: @@ -761,6 +765,25 @@ bfd.h: $(BFD_H_DEP) # We want install to imply install-info as per GNU standards, despite the # cygnus option. install: install-info + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 219a834..d5a81db 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1284,8 +1284,8 @@ bfinfdpic_relocs_info_hash (const void *entry_) const struct bfinfdpic_relocs_info *entry = entry_; return (entry->symndx == -1 - ? entry->d.h->root.root.hash - : entry->symndx + entry->d.abfd->id * 257) + entry->addend; + ? (long) entry->d.h->root.root.hash + : entry->symndx + (long) entry->d.abfd->id * 257) + entry->addend; } /* Test whether the key fields of two bfinfdpic_relocs_info entries are @@ -3253,7 +3253,6 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) flagword flags, pltflags; asection *s; struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; const struct elf_backend_data *bed = get_elf_backend_data (abfd); int ptralign; int offset; @@ -3343,23 +3342,6 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) flags = BSF_GLOBAL | BSF_WEAK; } - /* Define _gp in .rofixup, for FDPIC, or .got otherwise. If it - turns out that we're linking with a different linker script, the - linker script will override it. */ - bh = NULL; - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_gp", flags, s, offset, (const char *) NULL, FALSE, - bed->collect, &bh))) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - h->def_regular = 1; - h->type = STT_OBJECT; - /* h->other = STV_HIDDEN; */ /* Should we? */ - - /* Machine-specific: we want the symbol for executables as well. */ - if (IS_FDPIC (abfd) && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - return TRUE; } diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index bc44cba..754aa52 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -582,6 +582,10 @@ struct elf_i386_link_hash_entry #define GOT_TLS_IE_NEG 6 #define GOT_TLS_IE_BOTH 7 #define GOT_TLS_GDESC 8 +#define GOT_TLS_MASK 0x0f +#define GOT_TLS_IE_IE 0x10 +#define GOT_TLS_IE_GD 0x20 +#define GOT_TLS_IE_MASK 0x30 #define GOT_TLS_GD_BOTH_P(type) \ ((type) == (GOT_TLS_GD | GOT_TLS_GDESC)) #define GOT_TLS_GD_P(type) \ @@ -1007,12 +1011,25 @@ elf_i386_check_relocs (bfd *abfd, case R_386_TLS_IE_32: if (ELF32_R_TYPE (rel->r_info) == r_type) tls_type = GOT_TLS_IE_NEG; + else if (h + && ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD) + /* If this is a GD->IE transition, we may use either + of R_386_TLS_TPOFF and R_386_TLS_TPOFF32. But if + we may have both R_386_TLS_IE and R_386_TLS_GD, + we can't share the same R_386_TLS_TPOFF since + they require different offsets. So we remember + it comes from R_386_TLS_GD. */ + tls_type = GOT_TLS_IE | GOT_TLS_IE_GD; else - /* If this is a GD->IE transition, we may use either of - R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */ tls_type = GOT_TLS_IE; break; case R_386_TLS_IE: + if (h) + { + /* We remember it comes from R_386_TLS_IE. */ + tls_type = GOT_TLS_IE_POS | GOT_TLS_IE_IE; + break; + } case R_386_TLS_GOTIE: tls_type = GOT_TLS_IE_POS; break; } @@ -1052,7 +1069,8 @@ elf_i386_check_relocs (bfd *abfd, tls_type |= old_tls_type; /* If a TLS symbol is accessed using IE at least once, there is no point to use dynamic model for it. */ - else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN + else if (old_tls_type != tls_type + && old_tls_type != GOT_UNKNOWN && (! GOT_TLS_GD_ANY_P (old_tls_type) || (tls_type & GOT_TLS_IE) == 0)) { @@ -1682,6 +1700,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) asection *s; bfd_boolean dyn; int tls_type = elf_i386_hash_entry(h)->tls_type; + + /* If we have both R_386_TLS_IE and R_386_TLS_GD, GOT_TLS_IE_BOTH + should be used. */ + if ((tls_type & GOT_TLS_IE_MASK) + == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) + tls_type = GOT_TLS_IE_BOTH; + else + tls_type &= GOT_TLS_MASK; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ @@ -2685,6 +2711,13 @@ elf_i386_relocate_section (bfd *output_bfd, else if (h != NULL) { tls_type = elf_i386_hash_entry(h)->tls_type; + /* If we have both R_386_TLS_IE and R_386_TLS_GD, + GOT_TLS_IE_BOTH should be used. */ + if ((tls_type & GOT_TLS_IE_MASK) + == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) + tls_type = GOT_TLS_IE_BOTH; + else + tls_type &= GOT_TLS_MASK; if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE)) r_type = R_386_TLS_LE_32; } diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index f56efd2..5e9f3ab 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -482,6 +482,22 @@ m32c_elf_relocate_section relocation = (splt->output_section->vma + splt->output_offset + (*plt_offset & -2)); + if (name) + { + char *newname = bfd_malloc (strlen(name)+5); + strcpy (newname, name); + strcat(newname, ".plt"); + _bfd_generic_link_add_one_symbol (info, + input_bfd, + newname, + BSF_FUNCTION | BSF_WEAK, + splt, + (*plt_offset & -2), + 0, + 1, + 0, + 0); + } } } break; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 031b303..3bfb38a 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -26,6 +26,7 @@ #include "elf/sparc.h" #include "opcode/sparc.h" #include "elfxx-sparc.h" +#include "elf-vxworks.h" /* Support for core dump NOTE sections. */ @@ -215,3 +216,68 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) #define elf_backend_rela_normal 1 #include "elf32-target.h" + +/* A wrapper around _bfd_sparc_elf_link_hash_table_create that identifies + the target system as VxWorks. */ + +static struct bfd_link_hash_table * +elf32_sparc_vxworks_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = _bfd_sparc_elf_link_hash_table_create (abfd); + if (ret) + { + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = (struct _bfd_sparc_elf_link_hash_table *) ret; + htab->is_vxworks = 1; + } + return ret; +} + +/* A final_write_processing hook that does both the SPARC- and VxWorks- + specific handling. */ + +static void +elf32_sparc_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) +{ + elf32_sparc_final_write_processing (abfd, linker); + elf_vxworks_final_write_processing (abfd, linker); +} + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_sparc_vxworks_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sparc-vxworks" + +#undef ELF_MINPAGESIZE +#define ELF_MINPAGESIZE 0x1000 + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + elf32_sparc_vxworks_link_hash_table_create + +#undef elf_backend_want_got_plt +#define elf_backend_want_got_plt 1 +#undef elf_backend_plt_readonly +#define elf_backend_plt_readonly 1 +#undef elf_backend_got_header_size +#define elf_backend_got_header_size 12 +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook \ + elf_vxworks_add_symbol_hook +#undef elf_backend_link_output_symbol_hook +#define elf_backend_link_output_symbol_hook \ + elf_vxworks_link_output_symbol_hook +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs \ + elf_vxworks_emit_relocs +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + elf32_sparc_vxworks_final_write_processing + +#undef elf32_bed +#define elf32_bed sparc_elf_vxworks_bed + +#include "elf32-target.h" diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 4dce0ea..7a41d62 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -5766,7 +5766,8 @@ static bfd_boolean compute_text_actions static bfd_boolean compute_ebb_proposed_actions (ebb_constraint *); static bfd_boolean compute_ebb_actions (ebb_constraint *); static bfd_boolean check_section_ebb_pcrels_fit - (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, const ebb_constraint *); + (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, const ebb_constraint *, + const xtensa_opcode *); static bfd_boolean check_section_ebb_reduces (const ebb_constraint *); static void text_action_add_proposed (text_action_list *, const ebb_constraint *, asection *); @@ -6302,6 +6303,24 @@ find_associated_l32r_irel (bfd *abfd, } +static xtensa_opcode * +build_reloc_opcodes (bfd *abfd, + asection *sec, + bfd_byte *contents, + Elf_Internal_Rela *internal_relocs) +{ + unsigned i; + xtensa_opcode *reloc_opcodes = + (xtensa_opcode *) bfd_malloc (sizeof (xtensa_opcode) * sec->reloc_count); + for (i = 0; i < sec->reloc_count; i++) + { + Elf_Internal_Rela *irel = &internal_relocs[i]; + reloc_opcodes[i] = get_relocation_opcode (abfd, sec, contents, irel); + } + return reloc_opcodes; +} + + /* The compute_text_actions function will build a list of potential transformation actions for code in the extended basic block of each longcall that is optimized to a direct call. From this list we @@ -6318,6 +6337,7 @@ compute_text_actions (bfd *abfd, asection *sec, struct bfd_link_info *link_info) { + xtensa_opcode *reloc_opcodes = NULL; xtensa_relax_info *relax_info; bfd_byte *contents; Elf_Internal_Rela *internal_relocs; @@ -6423,11 +6443,17 @@ compute_text_actions (bfd *abfd, ebb->start_reloc_idx = i; ebb->end_reloc_idx = i; + /* Precompute the opcode for each relocation. */ + if (reloc_opcodes == NULL) + reloc_opcodes = build_reloc_opcodes (abfd, sec, contents, + internal_relocs); + if (!extend_ebb_bounds (ebb) || !compute_ebb_proposed_actions (&ebb_table) || !compute_ebb_actions (&ebb_table) || !check_section_ebb_pcrels_fit (abfd, sec, contents, - internal_relocs, &ebb_table) + internal_relocs, &ebb_table, + reloc_opcodes) || !check_section_ebb_reduces (&ebb_table)) { /* If anything goes wrong or we get unlucky and something does @@ -6459,6 +6485,8 @@ error_return: release_internal_relocs (sec, internal_relocs); if (prop_table) free (prop_table); + if (reloc_opcodes) + free (reloc_opcodes); return ok; } @@ -7026,7 +7054,8 @@ check_section_ebb_pcrels_fit (bfd *abfd, asection *sec, bfd_byte *contents, Elf_Internal_Rela *internal_relocs, - const ebb_constraint *constraint) + const ebb_constraint *constraint, + const xtensa_opcode *reloc_opcodes) { unsigned i, j; Elf_Internal_Rela *irel; @@ -7117,7 +7146,10 @@ check_section_ebb_pcrels_fit (bfd *abfd, xtensa_opcode opcode; int opnum; - opcode = get_relocation_opcode (abfd, sec, contents, irel); + if (reloc_opcodes) + opcode = reloc_opcodes[i]; + else + opcode = get_relocation_opcode (abfd, sec, contents, irel); if (opcode == XTENSA_UNDEFINED) { ok = FALSE; @@ -7814,7 +7846,7 @@ move_shared_literal (asection *sec, relocs_fit = check_section_ebb_pcrels_fit (target_sec->owner, target_sec, target_sec_cache->contents, target_sec_cache->relocs, - &ebb_table); + &ebb_table, NULL); if (!relocs_fit) return FALSE; diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 4e0b83c..58798ae 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -2542,6 +2542,68 @@ elf64_hppa_finish_dynamic_sections (output_bfd, info) return TRUE; } +/* Support for core dump NOTE sections. */ + +static bfd_boolean +elf64_hppa_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + size_t size; + + switch (note->descsz) + { + default: + return FALSE; + + case 760: /* Linux/hppa */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32); + + /* pr_reg */ + offset = 112; + size = 640; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + size, note->descpos + offset); +} + +static bfd_boolean +elf64_hppa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + char * command; + int n; + + switch (note->descsz) + { + default: + return FALSE; + + case 136: /* Linux/hppa elf_prpsinfo. */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + command = elf_tdata (abfd)->core_command; + n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + + return TRUE; +} + /* Return the number of additional phdrs we will need. The generic ELF code only creates PT_PHDRs for executables. The HP @@ -2775,7 +2837,9 @@ const struct elf_size_info hppa64_elf_size_info = elf64_hppa_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections \ elf64_hppa_finish_dynamic_sections - +#define elf_backend_grok_prstatus elf64_hppa_grok_prstatus +#define elf_backend_grok_psinfo elf64_hppa_grok_psinfo + /* Stuff for the BFD linker: */ #define bfd_elf64_bfd_link_hash_table_create \ elf64_hppa_hash_table_create diff --git a/bfd/elfcode.h b/bfd/elfcode.h index f7f85ba..9bb66e1 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -742,9 +742,18 @@ elf_object_p (bfd *abfd) if (i_ehdrp->e_shstrndx >= elf_numsections (abfd) || (i_ehdrp->e_shstrndx >= SHN_LORESERVE && i_ehdrp->e_shstrndx <= SHN_HIRESERVE)) - goto got_wrong_format_error; + { + /* PR 2257: + We used to just goto got_wrong_format_error here + but there are binaries in existance for which this test + will prevent the binutils from working with them at all. + So we are kind, and reset the string index value to 0 + so that at least some processing can be done. */ + i_ehdrp->e_shstrndx = SHN_UNDEF; + _bfd_error_handler (_("warning: %s has a corrupt string table index - ignoring"), abfd->filename); + } } - else if (i_ehdrp->e_shstrndx != 0) + else if (i_ehdrp->e_shstrndx != SHN_UNDEF) goto got_wrong_format_error; /* Read in the program headers. */ diff --git a/bfd/elflink.c b/bfd/elflink.c index 88e56da..0900220 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -889,6 +889,26 @@ _bfd_elf_merge_symbol (bfd *abfd, && h->root.type != bfd_link_hash_undefweak && h->root.type != bfd_link_hash_common); + /* When we try to create a default indirect symbol from the dynamic + definition with the default version, we skip it if its type and + the type of existing regular definition mismatch. We only do it + if the existing regular definition won't be dynamic. */ + if (pold_alignment == NULL + && !info->shared + && !info->export_dynamic + && !h->ref_dynamic + && newdyn + && newdef + && !olddyn + && (olddef || h->root.type == bfd_link_hash_common) + && ELF_ST_TYPE (sym->st_info) != h->type + && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE + && h->type != STT_NOTYPE) + { + *skip = TRUE; + return TRUE; + } + /* Check TLS symbol. We don't check undefined symbol introduced by "ld -u". */ if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS) @@ -6184,6 +6204,24 @@ elf_link_output_sym (struct elf_final_link_info *finfo, return TRUE; } +/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */ + +static bfd_boolean +check_dynsym (bfd *abfd, Elf_Internal_Sym *sym) +{ + if (sym->st_shndx > SHN_HIRESERVE) + { + /* The gABI doesn't support dynamic symbols in output sections + beyond 64k. */ + (*_bfd_error_handler) + (_("%B: Too many sections: %d (>= %d)"), + abfd, bfd_count_sections (abfd), SHN_LORESERVE); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + return TRUE; +} + /* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in allowing an unsatisfied unversioned symbol in the DSO to match a versioned symbol that would normally require an explicit version. @@ -6616,6 +6654,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) sym.st_name = h->dynstr_index; esym = finfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym; + if (! check_dynsym (finfo->output_bfd, &sym)) + { + eoinfo->failed = TRUE; + return FALSE; + } bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0); bucketcount = elf_hash_table (finfo->info)->bucketcount; @@ -8293,6 +8336,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) indx = elf_section_data (s)->this_idx; BFD_ASSERT (indx > 0); sym.st_shndx = indx; + if (! check_dynsym (abfd, &sym)) + return FALSE; sym.st_value = s->vma; dest = dynsym + dynindx * bed->s->sizeof_sym; if (last_local < dynindx) @@ -8327,6 +8372,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) sym.st_shndx = elf_section_data (s->output_section)->this_idx; + if (! check_dynsym (abfd, &sym)) + return FALSE; sym.st_value = (s->output_section->vma + s->output_offset + e->isym.st_value); diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index f0bb0fa..6b3257a 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -80,9 +80,6 @@ struct elfNN_ia64_dyn_sym_info /* The addend for which this entry is relevant. */ bfd_vma addend; - /* Next addend in the list. */ - struct elfNN_ia64_dyn_sym_info *next; - bfd_vma got_offset; bfd_vma fptr_offset; bfd_vma pltoff_offset; @@ -133,6 +130,13 @@ struct elfNN_ia64_local_hash_entry { int id; unsigned int r_sym; + /* The number of elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int count; + /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int sorted_count; + /* The size of elfNN_ia64_dyn_sym_info array. */ + unsigned int size; + /* The array of elfNN_ia64_dyn_sym_info. */ struct elfNN_ia64_dyn_sym_info *info; /* TRUE if this hash entry's addends was translated for @@ -143,6 +147,13 @@ struct elfNN_ia64_local_hash_entry struct elfNN_ia64_link_hash_entry { struct elf_link_hash_entry root; + /* The number of elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int count; + /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int sorted_count; + /* The size of elfNN_ia64_dyn_sym_info array. */ + unsigned int size; + /* The array of elfNN_ia64_dyn_sym_info. */ struct elfNN_ia64_dyn_sym_info *info; }; @@ -852,6 +863,12 @@ elfNN_ia64_relax_brl (bfd_byte *contents, bfd_vma off) bfd_putl64 (t0, hit_addr); bfd_putl64 (t1, hit_addr + 8); } + +/* Rename some of the generic section flags to better document how they + are used here. */ +#define skip_relax_pass_0 need_finalize_relax +#define skip_relax_pass_1 has_gp_reloc + /* These functions do relaxation for IA-64 ELF. */ @@ -880,6 +897,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) bfd_boolean changed_contents = FALSE; bfd_boolean changed_relocs = FALSE; bfd_boolean changed_got = FALSE; + bfd_boolean skip_relax_pass_0 = TRUE; + bfd_boolean skip_relax_pass_1 = TRUE; bfd_vma gp = 0; /* Assume we're not going to change any sizes, and we'll only need @@ -891,11 +910,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) return FALSE; /* Nothing to do if there are no relocations or there is no need for - the relax finalize pass. */ + the current pass. */ if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 - || (!link_info->need_relax_finalize - && sec->need_finalize_relax == 0)) + || (link_info->relax_pass == 0 && sec->skip_relax_pass_0) + || (link_info->relax_pass == 1 && sec->skip_relax_pass_1)) return TRUE; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; @@ -936,20 +955,19 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_PCREL21BI: case R_IA64_PCREL21M: case R_IA64_PCREL21F: - /* In the finalize pass, all br relaxations are done. We can - skip it. */ - if (!link_info->need_relax_finalize) + /* In pass 1, all br relaxations are done. We can skip it. */ + if (link_info->relax_pass == 1) continue; + skip_relax_pass_0 = FALSE; is_branch = TRUE; break; case R_IA64_PCREL60B: - /* We can't optimize brl to br before the finalize pass since - br relaxations will increase the code size. Defer it to - the finalize pass. */ - if (link_info->need_relax_finalize) + /* We can't optimize brl to br in pass 0 since br relaxations + will increase the code size. Defer it to pass 1. */ + if (link_info->relax_pass == 0) { - sec->need_finalize_relax = 1; + skip_relax_pass_1 = FALSE; continue; } is_branch = TRUE; @@ -957,12 +975,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_LTOFF22X: case R_IA64_LDXMOV: - /* We can't relax ldx/mov before the finalize pass since - br relaxations will increase the code size. Defer it to - the finalize pass. */ - if (link_info->need_relax_finalize) + /* We can't relax ldx/mov in pass 0 since br relaxations will + increase the code size. Defer it to pass 1. */ + if (link_info->relax_pass == 0) { - sec->need_finalize_relax = 1; + skip_relax_pass_1 = FALSE; continue; } is_branch = FALSE; @@ -1352,8 +1369,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } } - if (!link_info->need_relax_finalize) - sec->need_finalize_relax = 0; + if (link_info->relax_pass == 0) + { + /* Pass 0 is only needed to relax br. */ + sec->skip_relax_pass_0 = skip_relax_pass_0; + sec->skip_relax_pass_1 = skip_relax_pass_1; + } *again = changed_contents || changed_relocs; return TRUE; @@ -1369,6 +1390,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) free (internal_relocs); return FALSE; } +#undef skip_relax_pass_0 +#undef skip_relax_pass_1 static void elfNN_ia64_relax_ldxmov (contents, off) @@ -1799,6 +1822,9 @@ elfNN_ia64_new_elf_hash_entry (entry, table, string) table, string)); ret->info = NULL; + ret->count = 0; + ret->sorted_count = 0; + ret->size = 0; return (struct bfd_hash_entry *) ret; } @@ -1829,16 +1855,25 @@ elfNN_ia64_hash_copy_indirect (info, xdir, xind) if (ind->info != NULL) { struct elfNN_ia64_dyn_sym_info *dyn_i; - struct elfNN_ia64_dyn_sym_info **pdyn; + unsigned int count; + + if (dir->info) + free (dir->info); + + dir->info = ind->info; + dir->count = ind->count; + dir->sorted_count = ind->sorted_count; + dir->size = ind->size; - pdyn = &dir->info; - while ((dyn_i = *pdyn) != NULL) - pdyn = &dyn_i->next; - *pdyn = dyn_i = ind->info; ind->info = NULL; + ind->count = 0; + ind->sorted_count = 0; + ind->size = 0; /* Fix up the dyn_sym_info pointers to the global symbol. */ - for (; dyn_i; dyn_i = dyn_i->next) + for (count = dir->count, dyn_i = dir->info; + count != 0; + count--, dyn_i++) dyn_i->h = &dir->root; } @@ -1864,12 +1899,15 @@ elfNN_ia64_hash_hide_symbol (info, xh, force_local) { struct elfNN_ia64_link_hash_entry *h; struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; h = (struct elfNN_ia64_link_hash_entry *)xh; _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local); - for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next) + for (count = h->count, dyn_i = h->info; + count != 0; + count--, dyn_i++) { dyn_i->want_plt2 = 0; dyn_i->want_plt = 0; @@ -1937,6 +1975,51 @@ elfNN_ia64_hash_table_create (abfd) return &ret->root.root; } +/* Free the global elfNN_ia64_dyn_sym_info array. */ + +static bfd_boolean +elfNN_ia64_global_dyn_info_free (void **xentry, + PTR unused ATTRIBUTE_UNUSED) +{ + struct elfNN_ia64_link_hash_entry *entry + = (struct elfNN_ia64_link_hash_entry *) xentry; + + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link; + + if (entry->info) + { + free (entry->info); + entry->info = NULL; + entry->count = 0; + entry->sorted_count = 0; + entry->size = 0; + } + + return TRUE; +} + +/* Free the local elfNN_ia64_dyn_sym_info array. */ + +static bfd_boolean +elfNN_ia64_local_dyn_info_free (void **slot, + PTR unused ATTRIBUTE_UNUSED) +{ + struct elfNN_ia64_local_hash_entry *entry + = (struct elfNN_ia64_local_hash_entry *) *slot; + + if (entry->info) + { + free (entry->info); + entry->info = NULL; + entry->count = 0; + entry->sorted_count = 0; + entry->size = 0; + } + + return TRUE; +} + /* Destroy IA-64 linker hash table. */ static void @@ -1946,9 +2029,15 @@ elfNN_ia64_hash_table_free (hash) struct elfNN_ia64_link_hash_table *ia64_info = (struct elfNN_ia64_link_hash_table *) hash; if (ia64_info->loc_hash_table) - htab_delete (ia64_info->loc_hash_table); + { + htab_traverse (ia64_info->loc_hash_table, + elfNN_ia64_local_dyn_info_free, NULL); + htab_delete (ia64_info->loc_hash_table); + } if (ia64_info->loc_hash_memory) objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory); + elf_link_hash_traverse (&ia64_info->root, + elfNN_ia64_global_dyn_info_free, NULL); _bfd_generic_link_hash_table_free (hash); } @@ -1970,11 +2059,14 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata) struct elfNN_ia64_dyn_sym_traverse_data *data = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; if (entry->root.root.type == bfd_link_hash_warning) entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link; - for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) + for (count = entry->count, dyn_i = entry->info; + count != 0; + count--, dyn_i++) if (! (*data->func) (dyn_i, data->data)) return FALSE; return TRUE; @@ -1990,11 +2082,14 @@ elfNN_ia64_local_dyn_sym_thunk (slot, xdata) struct elfNN_ia64_dyn_sym_traverse_data *data = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; - for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) + for (count = entry->count, dyn_i = entry->info; + count != 0; + count--, dyn_i++) if (! (*data->func) (dyn_i, data->data)) - return 0; - return 1; + return FALSE; + return TRUE; } static void @@ -2103,8 +2198,129 @@ get_local_sym_hash (ia64_info, abfd, rel, create) return ret; } +/* Used to sort elfNN_ia64_dyn_sym_info array. */ + +static int +addend_compare (const void *xp, const void *yp) +{ + const struct elfNN_ia64_dyn_sym_info *x + = (const struct elfNN_ia64_dyn_sym_info *) xp; + const struct elfNN_ia64_dyn_sym_info *y + = (const struct elfNN_ia64_dyn_sym_info *) yp; + + return x->addend - y->addend; +} + +/* Sort elfNN_ia64_dyn_sym_info array and remove duplicates. */ + +static unsigned int +sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info, + unsigned int count) +{ + bfd_vma curr, prev; + unsigned int i, dup, diff, dest, src, len; + + qsort (info, count, sizeof (*info), addend_compare); + + /* Find the first duplicate. */ + prev = info [0].addend; + for (i = 1; i < count; i++) + { + curr = info [i].addend; + if (curr == prev) + break; + prev = curr; + } + + /* Remove duplicates. */ + if (i < count) + { + /* We need to move a block of elements to here. */ + dest = i++; + while (i < count) + { + curr = info [i].addend; + + /* Move a block of elements whose first one is different from + the previous. */ + if (curr == prev) + { + for (src = i + 1; src < count; src++) + if (info [src].addend != curr) + break; + } + else + src = i; + + if (src >= count) + break; + + /* Find the next duplicate. */ + prev = info [src].addend; + for (dup = src + 1; dup < count; dup++) + { + curr = info [dup].addend; + if (curr == prev) + break; + prev = curr; + } + + /* How much to move. */ + len = dup - src; + i = dup + 1; + + if (len == 1 && dup < count) + { + /* If we only move 1 element, we combine it with the next + one. Find the next different one. */ + for (diff = dup + 1, src++; diff < count; diff++, src++) + if (info [diff].addend != curr) + break; + + if (diff < count) + { + /* Find the next duplicate. */ + prev = info [diff].addend; + for (dup = diff + 1; dup < count; dup++) + { + curr = info [dup].addend; + if (curr == prev) + break; + prev = curr; + diff++; + } + + len = diff - src + 1; + i = diff + 1; + } + } + + memmove (&info [dest], &info [src], len * sizeof (*info)); + + dest += len; + } + + count = dest; + } + + return count; +} + /* Find and/or create a descriptor for dynamic symbol info. This will - vary based on global or local symbol, and the addend to the reloc. */ + vary based on global or local symbol, and the addend to the reloc. + + We don't sort when inserting. Also, we sort and eliminate + duplicates if there is an unsorted section. Typically, this will + only happen once, because we do all insertions before lookups. We + then use bsearch to do a lookup. This also allows lookups to be + fast. So we have fast insertion (O(log N) due to duplicate check), + fast lookup (O(log N)) and one sort (O(N log N) expected time). + Previously, all lookups were O(N) because of the use of the linked + list and also all insertions were O(N) because of the check for + duplicates. There are some complications here because the array + size grows occasionally, which may add an O(N) factor, but this + should be rare. Also, we free the excess array allocation, which + requires a copy which is O(N), but this only happens once. */ static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info (ia64_info, h, abfd, rel, create) @@ -2114,12 +2330,22 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create) const Elf_Internal_Rela *rel; bfd_boolean create; { - struct elfNN_ia64_dyn_sym_info **pp; - struct elfNN_ia64_dyn_sym_info *dyn_i; + struct elfNN_ia64_dyn_sym_info **info_p, *info, *dyn_i, key; + unsigned int *count_p, *sorted_count_p, *size_p; + unsigned int count, sorted_count, size; bfd_vma addend = rel ? rel->r_addend : 0; + bfd_size_type amt; if (h) - pp = &((struct elfNN_ia64_link_hash_entry *)h)->info; + { + struct elfNN_ia64_link_hash_entry *global_h; + + global_h = (struct elfNN_ia64_link_hash_entry *) h; + info_p = &global_h->info; + count_p = &global_h->count; + sorted_count_p = &global_h->sorted_count; + size_p = &global_h->size; + } else { struct elfNN_ia64_local_hash_entry *loc_h; @@ -2131,18 +2357,107 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create) return NULL; } - pp = &loc_h->info; + info_p = &loc_h->info; + count_p = &loc_h->count; + sorted_count_p = &loc_h->sorted_count; + size_p = &loc_h->size; } - for (dyn_i = *pp; dyn_i && dyn_i->addend != addend; dyn_i = *pp) - pp = &dyn_i->next; - - if (dyn_i == NULL && create) + count = *count_p; + sorted_count = *sorted_count_p; + size = *size_p; + info = *info_p; + if (create) { - dyn_i = ((struct elfNN_ia64_dyn_sym_info *) - bfd_zalloc (abfd, (bfd_size_type) sizeof *dyn_i)); - *pp = dyn_i; + /* When we create the array, we don't check for duplicates, + except in the previously sorted section if one exists, and + against the last inserted entry. This allows insertions to + be fast. */ + if (info) + { + if (sorted_count) + { + /* Try bsearch first on the sorted section. */ + key.addend = addend; + dyn_i = bsearch (&key, info, sorted_count, + sizeof (*info), addend_compare); + + if (dyn_i) + { + return dyn_i; + } + } + + /* Do a quick check for the last inserted entry. */ + dyn_i = info + count - 1; + if (dyn_i->addend == addend) + { + return dyn_i; + } + } + + if (size == 0) + { + /* It is the very first element. We create the array of size + 1. */ + size = 1; + amt = size * sizeof (*info); + info = bfd_malloc (amt); + } + else if (size <= count) + { + /* We double the array size every time when we reach the + size limit. */ + size += size; + amt = size * sizeof (*info); + info = bfd_realloc (info, amt); + } + else + goto has_space; + + if (info == NULL) + return NULL; + *size_p = size; + *info_p = info; + +has_space: + /* Append the new one to the array. */ + dyn_i = info + count; + memset (dyn_i, 0, sizeof (*dyn_i)); dyn_i->addend = addend; + + /* We increment count only since the new ones are unsorted and + may have duplicate. */ + (*count_p)++; + } + else + { + /* It is a lookup without insertion. Sort array if part of the + array isn't sorted. */ + if (count != sorted_count) + { + count = sort_dyn_sym_info (info, count); + *count_p = count; + *sorted_count_p = count; + } + + /* Free unused memory. */ + if (size != count) + { + amt = count * sizeof (*info); + info = bfd_malloc (amt); + if (info != NULL) + { + memcpy (info, *info_p, amt); + free (*info_p); + *size_p = count; + *info_p = info; + } + } + + key.addend = addend; + dyn_i = bsearch (&key, info, count, + sizeof (*info), addend_compare); } return dyn_i; @@ -2368,6 +2683,23 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) Elf_Internal_Shdr *symtab_hdr; const Elf_Internal_Rela *rel; asection *got, *fptr, *srel, *pltoff; + enum { + NEED_GOT = 1, + NEED_GOTX = 2, + NEED_FPTR = 4, + NEED_PLTOFF = 8, + NEED_MIN_PLT = 16, + NEED_FULL_PLT = 32, + NEED_DYNREL = 64, + NEED_LTOFF_FPTR = 128, + NEED_TPREL = 256, + NEED_DTPMOD = 512, + NEED_DTPREL = 1024 + }; + int need_entry; + struct elf_link_hash_entry *h; + unsigned long r_symndx; + bfd_boolean maybe_dynamic; if (info->relocatable) return TRUE; @@ -2378,29 +2710,181 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) got = fptr = srel = pltoff = NULL; relend = relocs + sec->reloc_count; + + /* We scan relocations first to create dynamic relocation arrays. We + modified get_dyn_sym_info to allow fast insertion and support fast + lookup in the next loop. */ + for (rel = relocs; rel < relend; ++rel) + { + r_symndx = ELFNN_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + long indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + else + h = NULL; + + /* We can only get preliminary data on whether a symbol is + locally or externally defined, as not all of the input files + have yet been processed. Do something with what we know, as + this may help reduce memory usage and processing time later. */ + maybe_dynamic = (h && ((!info->executable + && (!info->symbolic + || info->unresolved_syms_in_shared_libs == RM_IGNORE)) + || !h->def_regular + || h->root.type == bfd_link_hash_defweak)); + + need_entry = 0; + switch (ELFNN_R_TYPE (rel->r_info)) + { + case R_IA64_TPREL64MSB: + case R_IA64_TPREL64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + break; + + case R_IA64_LTOFF_TPREL22: + need_entry = NEED_TPREL; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_IA64_DTPREL32MSB: + case R_IA64_DTPREL32LSB: + case R_IA64_DTPREL64MSB: + case R_IA64_DTPREL64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + break; + + case R_IA64_LTOFF_DTPREL22: + need_entry = NEED_DTPREL; + break; + + case R_IA64_DTPMOD64MSB: + case R_IA64_DTPMOD64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + break; + + case R_IA64_LTOFF_DTPMOD22: + need_entry = NEED_DTPMOD; + break; + + case R_IA64_LTOFF_FPTR22: + case R_IA64_LTOFF_FPTR64I: + case R_IA64_LTOFF_FPTR32MSB: + case R_IA64_LTOFF_FPTR32LSB: + case R_IA64_LTOFF_FPTR64MSB: + case R_IA64_LTOFF_FPTR64LSB: + need_entry = NEED_FPTR | NEED_GOT | NEED_LTOFF_FPTR; + break; + + case R_IA64_FPTR64I: + case R_IA64_FPTR32MSB: + case R_IA64_FPTR32LSB: + case R_IA64_FPTR64MSB: + case R_IA64_FPTR64LSB: + if (info->shared || h) + need_entry = NEED_FPTR | NEED_DYNREL; + else + need_entry = NEED_FPTR; + break; + + case R_IA64_LTOFF22: + case R_IA64_LTOFF64I: + need_entry = NEED_GOT; + break; + + case R_IA64_LTOFF22X: + need_entry = NEED_GOTX; + break; + + case R_IA64_PLTOFF22: + case R_IA64_PLTOFF64I: + case R_IA64_PLTOFF64MSB: + case R_IA64_PLTOFF64LSB: + need_entry = NEED_PLTOFF; + if (h) + { + if (maybe_dynamic) + need_entry |= NEED_MIN_PLT; + } + else + { + (*info->callbacks->warning) + (info, _("@pltoff reloc against local symbol"), 0, + abfd, 0, (bfd_vma) 0); + } + break; + + case R_IA64_PCREL21B: + case R_IA64_PCREL60B: + /* Depending on where this symbol is defined, we may or may not + need a full plt entry. Only skip if we know we'll not need + the entry -- static or symbolic, and the symbol definition + has already been seen. */ + if (maybe_dynamic && rel->r_addend == 0) + need_entry = NEED_FULL_PLT; + break; + + case R_IA64_IMM14: + case R_IA64_IMM22: + case R_IA64_IMM64: + case R_IA64_DIR32MSB: + case R_IA64_DIR32LSB: + case R_IA64_DIR64MSB: + case R_IA64_DIR64LSB: + /* Shared objects will always need at least a REL relocation. */ + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + break; + + case R_IA64_IPLTMSB: + case R_IA64_IPLTLSB: + /* Shared objects will always need at least a REL relocation. */ + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + break; + + case R_IA64_PCREL22: + case R_IA64_PCREL64I: + case R_IA64_PCREL32MSB: + case R_IA64_PCREL32LSB: + case R_IA64_PCREL64MSB: + case R_IA64_PCREL64LSB: + if (maybe_dynamic) + need_entry = NEED_DYNREL; + break; + } + + if (!need_entry) + continue; + + if ((need_entry & NEED_FPTR) != 0 + && rel->r_addend) + { + (*info->callbacks->warning) + (info, _("non-zero addend in @fptr reloc"), 0, + abfd, 0, (bfd_vma) 0); + } + + if (get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE) == NULL) + return FALSE; + } + + /* Now, we only do lookup without insertion, which is very fast + with the modified get_dyn_sym_info. */ for (rel = relocs; rel < relend; ++rel) { - enum { - NEED_GOT = 1, - NEED_GOTX = 2, - NEED_FPTR = 4, - NEED_PLTOFF = 8, - NEED_MIN_PLT = 16, - NEED_FULL_PLT = 32, - NEED_DYNREL = 64, - NEED_LTOFF_FPTR = 128, - NEED_TPREL = 256, - NEED_DTPMOD = 512, - NEED_DTPREL = 1024 - }; - - struct elf_link_hash_entry *h = NULL; - unsigned long r_symndx = ELFNN_R_SYM (rel->r_info); struct elfNN_ia64_dyn_sym_info *dyn_i; - int need_entry; - bfd_boolean maybe_dynamic; int dynrel_type = R_IA64_NONE; + r_symndx = ELFNN_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { /* We're dealing with a global symbol -- find its hash entry @@ -2413,18 +2897,18 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) h->ref_regular = 1; } + else + h = NULL; /* We can only get preliminary data on whether a symbol is locally or externally defined, as not all of the input files have yet been processed. Do something with what we know, as this may help reduce memory usage and processing time later. */ - maybe_dynamic = FALSE; - if (h && ((!info->executable - && (!info->symbolic - || info->unresolved_syms_in_shared_libs == RM_IGNORE)) - || !h->def_regular - || h->root.type == bfd_link_hash_defweak)) - maybe_dynamic = TRUE; + maybe_dynamic = (h && ((!info->executable + && (!info->symbolic + || info->unresolved_syms_in_shared_libs == RM_IGNORE)) + || !h->def_regular + || h->root.type == bfd_link_hash_defweak)); need_entry = 0; switch (ELFNN_R_TYPE (rel->r_info)) @@ -2508,12 +2992,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) if (maybe_dynamic) need_entry |= NEED_MIN_PLT; } - else - { - (*info->callbacks->warning) - (info, _("@pltoff reloc against local symbol"), 0, - abfd, 0, (bfd_vma) 0); - } break; case R_IA64_PCREL21B: @@ -2562,15 +3040,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) if (!need_entry) continue; - if ((need_entry & NEED_FPTR) != 0 - && rel->r_addend) - { - (*info->callbacks->warning) - (info, _("non-zero addend in @fptr reloc"), 0, - abfd, 0, (bfd_vma) 0); - } - - dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE); + dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, FALSE); /* Record whether or not this is a local symbol. */ dyn_i->h = h; @@ -4145,8 +4615,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (loc_h && ! loc_h->sec_merge_done) { struct elfNN_ia64_dyn_sym_info *dynent; + unsigned int count; - for (dynent = loc_h->info; dynent; dynent = dynent->next) + for (count = loc_h->count, dynent = loc_h->info; + count != 0; + count--, dynent++) { msec = sym_sec; dynent->addend = @@ -4161,6 +4634,10 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, - sym_sec->output_section->vma - sym_sec->output_offset; } + + qsort (loc_h->info, loc_h->count, + sizeof (*loc_h->info), addend_compare); + loc_h->sec_merge_done = 1; } } diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index cb5f7cb..ef7ff48 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -23,10 +23,12 @@ #include "sysdep.h" #include "bfdlink.h" #include "libbfd.h" +#include "libiberty.h" #include "elf-bfd.h" #include "elf/sparc.h" #include "opcode/sparc.h" #include "elfxx-sparc.h" +#include "elf-vxworks.h" /* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ #define MINUS_ONE (~ (bfd_vma) 0) @@ -697,6 +699,50 @@ sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset, return index - 4; } +/* The format of the first PLT entry in a VxWorks executable. */ +static const bfd_vma sparc_vxworks_exec_plt0_entry[] = + { + 0x05000000, /* sethi %hi(_GLOBAL_OFFSET_TABLE_+8), %g2 */ + 0x8410a000, /* or %g2, %lo(_GLOBAL_OFFSET_TABLE_+8), %g2 */ + 0xc4008000, /* ld [ %g2 ], %g2 */ + 0x81c08000, /* jmp %g2 */ + 0x01000000 /* nop */ + }; + +/* The format of subsequent PLT entries. */ +static const bfd_vma sparc_vxworks_exec_plt_entry[] = + { + 0x03000000, /* sethi %hi(_GLOBAL_OFFSET_TABLE_+f@got), %g1 */ + 0x82106000, /* or %g1, %lo(_GLOBAL_OFFSET_TABLE_+f@got), %g1 */ + 0xc2004000, /* ld [ %g1 ], %g1 */ + 0x81c04000, /* jmp %g1 */ + 0x01000000, /* nop */ + 0x03000000, /* sethi %hi(f@pltindex), %g1 */ + 0x10800000, /* b _PLT_resolve */ + 0x82106000 /* or %g1, %lo(f@pltindex), %g1 */ + }; + +/* The format of the first PLT entry in a VxWorks shared object. */ +static const bfd_vma sparc_vxworks_shared_plt0_entry[] = + { + 0xc405e008, /* ld [ %l7 + 8 ], %g2 */ + 0x81c08000, /* jmp %g2 */ + 0x01000000 /* nop */ + }; + +/* The format of subsequent PLT entries. */ +static const bfd_vma sparc_vxworks_shared_plt_entry[] = + { + 0x03000000, /* sethi %hi(f@got), %g1 */ + 0x82106000, /* or %g1, %lo(f@got), %g1 */ + 0xc205c001, /* ld [ %l7 + %g1 ], %g1 */ + 0x81c04000, /* jmp %g1 */ + 0x01000000, /* nop */ + 0x03000000, /* sethi %hi(f@pltindex), %g1 */ + 0x10800000, /* b _PLT_resolve */ + 0x82106000 /* or %g1, %lo(f@pltindex), %g1 */ + }; + #define SPARC_ELF_PUT_WORD(htab, bfd, val, ptr) \ htab->put_word(bfd, val, ptr) @@ -781,7 +827,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd) ret->append_rela = sparc_elf_append_rela_64; ret->r_info = sparc_elf_r_info_64; ret->r_symndx = sparc_elf_r_symndx_64; - ret->build_plt_entry = sparc64_plt_entry_build; ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF64; ret->dtpmod_reloc = R_SPARC_TLS_DTPMOD64; ret->tpoff_reloc = R_SPARC_TLS_TPOFF64; @@ -798,7 +843,6 @@ _bfd_sparc_elf_link_hash_table_create (bfd *abfd) ret->append_rela = sparc_elf_append_rela_32; ret->r_info = sparc_elf_r_info_32; ret->r_symndx = sparc_elf_r_symndx_32; - ret->build_plt_entry = sparc32_plt_entry_build; ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF32; ret->dtpmod_reloc = R_SPARC_TLS_DTPMOD32; ret->tpoff_reloc = R_SPARC_TLS_TPOFF32; @@ -846,6 +890,14 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) || ! bfd_set_section_alignment (dynobj, htab->srelgot, htab->word_align_power)) return FALSE; + + if (htab->is_vxworks) + { + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (!htab->sgotplt) + return FALSE; + } + return TRUE; } @@ -872,6 +924,41 @@ _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj, if (!info->shared) htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); + if (htab->is_vxworks) + { + if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2)) + return FALSE; + if (info->shared) + { + htab->plt_header_size + = 4 * ARRAY_SIZE (sparc_vxworks_shared_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (sparc_vxworks_shared_plt_entry); + } + else + { + htab->plt_header_size + = 4 * ARRAY_SIZE (sparc_vxworks_exec_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (sparc_vxworks_exec_plt_entry); + } + } + else + { + if (ABI_64_P (dynobj)) + { + htab->build_plt_entry = sparc64_plt_entry_build; + htab->plt_header_size = PLT64_HEADER_SIZE; + htab->plt_entry_size = PLT64_ENTRY_SIZE; + } + else + { + htab->build_plt_entry = sparc32_plt_entry_build; + htab->plt_header_size = PLT32_HEADER_SIZE; + htab->plt_entry_size = PLT32_ENTRY_SIZE; + } + } + if (!htab->splt || !htab->srelplt || !htab->sdynbss || (!info->shared && !htab->srelbss)) abort (); @@ -1807,10 +1894,15 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) { asection *s = htab->splt; - /* The first four entries in .plt is reserved. */ + /* Allocate room for the header. */ if (s->size == 0) - s->size = (SPARC_ELF_WORD_BYTES(htab) == 8 ? - PLT64_HEADER_SIZE : PLT32_HEADER_SIZE); + { + s->size = htab->plt_header_size; + + /* Allocate space for the .rela.plt.unloaded relocations. */ + if (htab->is_vxworks && !info->shared) + htab->srelplt2->size = sizeof (Elf32_External_Rela) * 2; + } /* The procedure linkage table size is bounded by the magnitude of the offset we can describe in the entry. */ @@ -1847,11 +1939,20 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) } /* Make room for this entry. */ - s->size += (SPARC_ELF_WORD_BYTES(htab) == 8 ? - PLT64_ENTRY_SIZE : PLT32_ENTRY_SIZE); + s->size += htab->plt_entry_size; /* We also need to make an entry in the .rela.plt section. */ htab->srelplt->size += SPARC_ELF_RELA_BYTES (htab); + + if (htab->is_vxworks) + { + /* Allocate space for the .got.plt entry. */ + htab->sgotplt->size += 4; + + /* ...and for the .rela.plt.unloaded relocations. */ + if (!info->shared) + htab->srelplt2->size += sizeof (Elf32_External_Rela) * 3; + } } else { @@ -2153,6 +2254,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); if (! ABI_64_P (output_bfd) + && !htab->is_vxworks && elf_hash_table (info)->dynamic_sections_created) { /* Make space for the trailing nop in .plt. */ @@ -2179,7 +2281,8 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, if (s == htab->splt || s == htab->sgot - || s == htab->sdynbss) + || s == htab->sdynbss + || s == htab->sgotplt) { /* Strip this section if we don't need it; see the comment below. */ @@ -3428,6 +3531,97 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, return TRUE; } +/* Build a VxWorks PLT entry. PLT_INDEX is the index of the PLT entry + and PLT_OFFSET is the byte offset from the start of .plt. GOT_OFFSET + is the offset of the associated .got.plt entry from + _GLOBAL_OFFSET_TABLE_. */ + +static void +sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info, + bfd_vma plt_offset, bfd_vma plt_index, + bfd_vma got_offset) +{ + bfd_vma got_base; + const bfd_vma *plt_entry; + struct _bfd_sparc_elf_link_hash_table *htab; + bfd_byte *loc; + Elf_Internal_Rela rela; + + htab = _bfd_sparc_elf_hash_table (info); + if (info->shared) + { + plt_entry = sparc_vxworks_shared_plt_entry; + got_base = 0; + } + else + { + plt_entry = sparc_vxworks_exec_plt_entry; + got_base = (htab->elf.hgot->root.u.def.value + + htab->elf.hgot->root.u.def.section->output_offset + + htab->elf.hgot->root.u.def.section->output_section->vma); + } + + /* Fill in the entry in the procedure linkage table. */ + bfd_put_32 (output_bfd, plt_entry[0] + ((got_base + got_offset) >> 10), + htab->splt->contents + plt_offset); + bfd_put_32 (output_bfd, plt_entry[1] + ((got_base + got_offset) & 0x3ff), + htab->splt->contents + plt_offset + 4); + bfd_put_32 (output_bfd, plt_entry[2], + htab->splt->contents + plt_offset + 8); + bfd_put_32 (output_bfd, plt_entry[3], + htab->splt->contents + plt_offset + 12); + bfd_put_32 (output_bfd, plt_entry[4], + htab->splt->contents + plt_offset + 16); + bfd_put_32 (output_bfd, plt_entry[5] + (plt_index >> 10), + htab->splt->contents + plt_offset + 20); + /* PC-relative displacement for a branch to the start of + the PLT section. */ + bfd_put_32 (output_bfd, plt_entry[6] + (((-plt_offset - 24) >> 2) + & 0x003fffff), + htab->splt->contents + plt_offset + 24); + bfd_put_32 (output_bfd, plt_entry[7] + (plt_index & 0x3ff), + htab->splt->contents + plt_offset + 28); + + /* Fill in the .got.plt entry, pointing initially at the + second half of the PLT entry. */ + BFD_ASSERT (htab->sgotplt != NULL); + bfd_put_32 (output_bfd, + htab->splt->output_section->vma + + htab->splt->output_offset + + plt_offset + 20, + htab->sgotplt->contents + got_offset); + + /* Add relocations to .rela.plt.unloaded. */ + if (!info->shared) + { + loc = (htab->srelplt2->contents + + (2 + 3 * plt_index) * sizeof (Elf32_External_Rela)); + + /* Relocate the initial sethi. */ + rela.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + plt_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22); + rela.r_addend = got_offset; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Likewise the following or. */ + rela.r_offset += 4; + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Relocate the .got.plt entry. */ + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_SPARC_32); + rela.r_addend = plt_offset + 20; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } +} + /* Finish up dynamic symbol handling. We set the contents of various dynamic sections here. */ @@ -3449,7 +3643,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, asection *srela; Elf_Internal_Rela rela; bfd_byte *loc; - bfd_vma r_offset; + bfd_vma r_offset, got_offset; int rela_index; /* This symbol has an entry in the PLT. Set it up. */ @@ -3460,23 +3654,48 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, srela = htab->srelplt; BFD_ASSERT (splt != NULL && srela != NULL); - /* Fill in the entry in the procedure linkage table. */ - rela_index = SPARC_ELF_BUILD_PLT_ENTRY (htab, output_bfd, splt, - h->plt.offset, splt->size, - &r_offset); - /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = r_offset - + (splt->output_section->vma + splt->output_offset); - if (! ABI_64_P (output_bfd) - || h->plt.offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)) + if (htab->is_vxworks) { + /* Work out the index of this PLT entry. */ + rela_index = ((h->plt.offset - htab->plt_header_size) + / htab->plt_entry_size); + + /* Calculate the offset of the associated .got.plt entry. + The first three entries are reserved. */ + got_offset = (rela_index + 3) * 4; + + sparc_vxworks_build_plt_entry (output_bfd, info, h->plt.offset, + rela_index, got_offset); + + + /* On VxWorks, the relocation points to the .got.plt entry, + not the .plt entry. */ + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); rela.r_addend = 0; } else { - rela.r_addend = -(h->plt.offset + 4) - -(splt->output_section->vma + splt->output_offset); + /* Fill in the entry in the procedure linkage table. */ + rela_index = SPARC_ELF_BUILD_PLT_ENTRY (htab, output_bfd, splt, + h->plt.offset, splt->size, + &r_offset); + + rela.r_offset = r_offset + + (splt->output_section->vma + splt->output_offset); + if (! ABI_64_P (output_bfd) + || h->plt.offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)) + { + rela.r_addend = 0; + } + else + { + rela.r_addend = (-(h->plt.offset + 4) + - splt->output_section->vma + - splt->output_offset); + } } rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_JMP_SLOT); @@ -3577,10 +3796,12 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &rela); } - /* Mark some specially defined symbols as absolute. */ + /* Mark some specially defined symbols as absolute. On VxWorks, + _GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the + ".got" section. Likewise _PROCEDURE_LINKAGE_TABLE_ and ".plt". */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || h == htab->elf.hgot - || h == htab->elf.hplt) + || (!htab->is_vxworks + && (h == htab->elf.hgot || h == htab->elf.hplt))) sym->st_shndx = SHN_ABS; return TRUE; @@ -3648,13 +3869,14 @@ sparc64_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, #endif static bfd_boolean -sparc32_finish_dyn (bfd *output_bfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED, +sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, bfd *dynobj, asection *sdyn, asection *splt ATTRIBUTE_UNUSED) { Elf32_External_Dyn *dyncon, *dynconend; + struct _bfd_sparc_elf_link_hash_table *htab; + htab = _bfd_sparc_elf_hash_table (info); dyncon = (Elf32_External_Dyn *) sdyn->contents; dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) @@ -3665,34 +3887,150 @@ sparc32_finish_dyn (bfd *output_bfd, bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); - switch (dyn.d_tag) + if (htab->is_vxworks && dyn.d_tag == DT_RELASZ) { - case DT_PLTGOT: name = ".plt"; size = FALSE; break; - case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; - case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; - default: name = NULL; size = FALSE; break; + /* On VxWorks, DT_RELASZ should not include the relocations + in .rela.plt. */ + if (htab->srelplt) + { + dyn.d_un.d_val -= htab->srelplt->size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } } - - if (name != NULL) + else if (htab->is_vxworks && dyn.d_tag == DT_PLTGOT) { - asection *s; + /* On VxWorks, DT_PLTGOT should point to the start of the GOT, + not to the start of the PLT. */ + if (htab->sgotplt) + { + dyn.d_un.d_val = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset); + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + else + { + switch (dyn.d_tag) + { + case DT_PLTGOT: name = ".plt"; size = FALSE; break; + case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; + case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; + default: name = NULL; size = FALSE; break; + } - s = bfd_get_section_by_name (output_bfd, name); - if (s == NULL) - dyn.d_un.d_val = 0; - else + if (name != NULL) { - if (! size) - dyn.d_un.d_ptr = s->vma; + asection *s; + + s = bfd_get_section_by_name (output_bfd, name); + if (s == NULL) + dyn.d_un.d_val = 0; else - dyn.d_un.d_val = s->size; + { + if (! size) + dyn.d_un.d_ptr = s->vma; + else + dyn.d_un.d_val = s->size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); } } return TRUE; } +/* Install the first PLT entry in a VxWorks executable and make sure that + .rela.plt.unloaded relocations have the correct symbol indexes. */ + +static void +sparc_vxworks_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + Elf_Internal_Rela rela; + bfd_vma got_base; + bfd_byte *loc; + + htab = _bfd_sparc_elf_hash_table (info); + + /* Calculate the absolute value of _GLOBAL_OFFSET_TABLE_. */ + got_base = (htab->elf.hgot->root.u.def.section->output_section->vma + + htab->elf.hgot->root.u.def.section->output_offset + + htab->elf.hgot->root.u.def.value); + + /* Install the initial PLT entry. */ + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[0] + ((got_base + 8) >> 10), + htab->splt->contents); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[1] + ((got_base + 8) & 0x3ff), + htab->splt->contents + 4); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[2], + htab->splt->contents + 8); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[3], + htab->splt->contents + 12); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[4], + htab->splt->contents + 16); + + loc = htab->srelplt2->contents; + + /* Add an unloaded relocation for the initial entry's "sethi". */ + rela.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22); + rela.r_addend = 8; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Likewise the following "or". */ + rela.r_offset += 4; + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Fix up the remaining .rela.plt.unloaded relocations. They may have + the wrong symbol index for _G_O_T_ or _P_L_T_ depending on the order + in which symbols were output. */ + while (loc < htab->srelplt2->contents + htab->srelplt2->size) + { + Elf_Internal_Rela rel; + + /* The entry's initial "sethi" (against _G_O_T_). */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* The following "or" (also against _G_O_T_). */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* The .got.plt entry (against _P_L_T_). */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_SPARC_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + } +} + +/* Install the first PLT entry in a VxWorks shared object. */ + +static void +sparc_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + unsigned int i; + + htab = _bfd_sparc_elf_hash_table (info); + for (i = 0; i < ARRAY_SIZE (sparc_vxworks_shared_plt0_entry); i++) + bfd_put_32 (output_bfd, sparc_vxworks_shared_plt0_entry[i], + htab->splt->contents + i * 4); +} + bfd_boolean _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) { @@ -3726,18 +4064,24 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i /* Initialize the contents of the .plt section. */ if (splt->size > 0) { - if (ABI_64_P (output_bfd)) - memset (splt->contents, 0, 4 * PLT64_ENTRY_SIZE); + if (htab->is_vxworks) + { + if (info->shared) + sparc_vxworks_finish_shared_plt (output_bfd, info); + else + sparc_vxworks_finish_exec_plt (output_bfd, info); + } else { - memset (splt->contents, 0, 4 * PLT32_ENTRY_SIZE); - bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, - splt->contents + splt->size - 4); + memset (splt->contents, 0, htab->plt_header_size); + if (!ABI_64_P (output_bfd)) + bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, + splt->contents + splt->size - 4); } } - elf_section_data (splt->output_section)->this_hdr.sh_entsize = - (ABI_64_P (output_bfd) ? PLT64_ENTRY_SIZE : PLT32_ENTRY_SIZE); + elf_section_data (splt->output_section)->this_hdr.sh_entsize + = htab->plt_entry_size; } /* Set the first entry in the global offset table to the address of diff --git a/bfd/elfxx-sparc.h b/bfd/elfxx-sparc.h index 624aea527..0a5a88b 100644 --- a/bfd/elfxx-sparc.h +++ b/bfd/elfxx-sparc.h @@ -61,6 +61,15 @@ struct _bfd_sparc_elf_link_hash_table /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; + /* True if the target system is VxWorks. */ + int is_vxworks; + + /* The (unloaded but important) .rela.plt.unloaded section, for VxWorks. */ + asection *srelplt2; + + /* .got.plt is only used on VxWorks. */ + asection *sgotplt; + void (*put_word) (bfd *, bfd_vma, void *); void (*append_rela) (bfd *, asection *, Elf_Internal_Rela *); bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma); @@ -70,6 +79,8 @@ struct _bfd_sparc_elf_link_hash_table int dynamic_interpreter_size; unsigned int word_align_power; unsigned int align_power_max; + unsigned int plt_header_size; + unsigned int plt_entry_size; int bytes_per_word; int bytes_per_rela; int dtpoff_reloc; diff --git a/bfd/po/Make-in b/bfd/po/Make-in index 0885b6f..1f33c2f 100644 --- a/bfd/po/Make-in +++ b/bfd/po/Make-in @@ -1,6 +1,6 @@ # Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper -# Copyright 2001, 2003 Free Software Foundation, Inc. +# Copyright 2001, 2003, 2006 Free Software Foundation, Inc. # # This file may be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License @@ -123,6 +123,7 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot install: install-exec install-data install-exec: install-info: +install-html: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 1c11480..8bcf979 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -115,6 +115,7 @@ cpu-v850.c cpu-vax.c cpu-w65.c cpu-we32k.c +cpu-xc16x.c cpu-xstormy16.c cpu-xtensa.c cpu-z80.c @@ -174,6 +175,7 @@ elf32-sh-symbian.c elf32-sparc.c elf32-v850.c elf32-vax.c +elf32-xc16x.c elf32-xstormy16.c elf32-xtensa.c elf64-alpha.c diff --git a/bfd/targets.c b/bfd/targets.c index 0649179..849eb94 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -634,6 +634,7 @@ extern const bfd_target bfd_elf32_shlin_vec; extern const bfd_target bfd_elf32_shlnbsd_vec; extern const bfd_target bfd_elf32_shnbsd_vec; extern const bfd_target bfd_elf32_sparc_vec; +extern const bfd_target bfd_elf32_sparc_vxworks_vec; extern const bfd_target bfd_elf32_tradbigmips_vec; extern const bfd_target bfd_elf32_tradlittlemips_vec; extern const bfd_target bfd_elf32_us_cris_vec; @@ -948,6 +949,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_sh64blin_vec, #endif &bfd_elf32_sparc_vec, + &bfd_elf32_sparc_vxworks_vec, &bfd_elf32_tradbigmips_vec, &bfd_elf32_tradlittlemips_vec, &bfd_elf32_us_cris_vec, diff --git a/bfd/version.h b/bfd/version.h index 6166019..8957708 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20060330 +#define BFD_VERSION_DATE 20060420 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/bfd/warning.m4 b/bfd/warning.m4 index 2e2dd42..b366cad 100644 --- a/bfd/warning.m4 +++ b/bfd/warning.m4 @@ -4,7 +4,7 @@ AC_DEFUN([AM_BINUTILS_WARNINGS],[ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" AC_ARG_ENABLE(werror, - [ --enable-werror treat compile warnings as errors], + [ --enable-werror treat compile warnings as errors], [case "${enableval}" in yes | y) ERROR_ON_WARNING="yes" ;; no | n) ERROR_ON_WARNING="no" ;; @@ -27,7 +27,7 @@ if test "${GCC}" = yes ; then fi AC_ARG_ENABLE(build-warnings, -[ --enable-build-warnings Enable build-time compiler warnings], +[ --enable-build-warnings enable build-time compiler warnings], [case "${enableval}" in yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; no) if test "${GCC}" = yes ; then diff --git a/configure b/configure index 2dae3f1..733eacf 100755 --- a/configure +++ b/configure @@ -43,6 +43,12 @@ ac_help="$ac_help (and sometimes confusing) to the casual installer" ac_help="$ac_help --enable-werror enable -Werror in bootstrap stage2 and later" +ac_help="$ac_help + --with-datarootdir Use datarootdir as the data root directory." +ac_help="$ac_help + --with-docdir Install documentation in this directory." +ac_help="$ac_help + --with-htmldir Install html in this directory." # Initialize some variables set by options. # The variables have the same names as the options, with @@ -601,7 +607,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:605: checking host system type" >&5 +echo "configure:611: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -622,7 +628,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:626: checking target system type" >&5 +echo "configure:632: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -640,7 +646,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:644: checking build system type" >&5 +echo "configure:650: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -695,7 +701,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:699: checking for a BSD compatible install" >&5 +echo "configure:705: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -748,7 +754,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln works""... $ac_c" 1>&6 -echo "configure:752: checking whether ln works" >&5 +echo "configure:758: checking whether ln works" >&5 if eval "test \"`echo '$''{'acx_cv_prog_LN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -772,7 +778,7 @@ else fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:776: checking whether ln -s works" >&5 +echo "configure:782: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1247,9 +1253,6 @@ case "${target}" in *-*-vxworks*) noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}" ;; - m32c-*-*) - noconfigdirs="$noconfigdirs target-libstdc++-v3" - ;; alpha*-dec-osf*) # ld works, but does not support shared libraries. # newlib is not 64 bit ready. I'm not sure about fileutils. @@ -1857,7 +1860,7 @@ else # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1861: checking for $ac_word" >&5 +echo "configure:1864: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1887,7 +1890,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1891: checking for $ac_word" >&5 +echo "configure:1894: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1938,7 +1941,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1942: checking for $ac_word" >&5 +echo "configure:1945: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1970,7 +1973,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1974: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1977: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1981,12 +1984,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1985 "configure" +#line 1988 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2012,12 +2015,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2016: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2019: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2021: checking whether we are using GNU C" >&5 +echo "configure:2024: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2026,7 +2029,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2045,7 +2048,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2049: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2052: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2112,7 +2115,7 @@ fi # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2116: checking for $ac_word" >&5 +echo "configure:2119: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2144,7 +2147,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2148: checking for $ac_word" >&5 +echo "configure:2151: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2177,7 +2180,7 @@ fi fi echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2181: checking whether compiler driver understands Ada" >&5 +echo "configure:2184: checking whether compiler driver understands Ada" >&5 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2209,7 +2212,7 @@ else fi echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2213: checking how to compare bootstrapped objects" >&5 +echo "configure:2216: checking how to compare bootstrapped objects" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2307,9 +2310,9 @@ saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2311: checking for correct version of gmp.h" >&5 +echo "configure:2314: checking for correct version of gmp.h" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2333,12 +2336,12 @@ rm -f conftest* if test x"$have_gmp" = xyes; then echo $ac_n "checking for MPFR""... $ac_c" 1>&6 -echo "configure:2337: checking for MPFR" >&5 +echo "configure:2340: checking for MPFR" >&5 saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" cat > conftest.$ac_ext < #include @@ -2346,7 +2349,7 @@ int main() { mpfr_t n; mpfr_init(n); ; return 0; } EOF -if { (eval echo configure:2350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3350,6 +3353,20 @@ if test "x${use_gnu_ld}" = x && FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld' fi +# Search for other target-specific linker scripts and such. +case "${target}" in + m32c-*-* ) + if test -d ${srcdir}/libgloss/m32c; then + # This is for crt0.o + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/m32c' + # This is for r8c.ld + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/m32c' + # This is for libnosys.a + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys' + fi + ;; +esac + # Makefile fragments. for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag; do @@ -3397,7 +3414,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3401: checking for $ac_word" >&5 +echo "configure:3418: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3437,7 +3454,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3441: checking for $ac_word" >&5 +echo "configure:3458: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3476,7 +3493,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3480: checking for $ac_word" >&5 +echo "configure:3497: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3515,7 +3532,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3519: checking for $ac_word" >&5 +echo "configure:3536: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3555,7 +3572,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3559: checking for $ac_word" >&5 +echo "configure:3576: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3594,7 +3611,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3598: checking for $ac_word" >&5 +echo "configure:3615: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3628,10 +3645,10 @@ case " $build_configdirs " in *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;; *) - # For an installed makeinfo, we require it to be from texinfo 4.2 or + # For an installed makeinfo, we require it to be from texinfo 4.4 or # higher, else we use the "missing" dummy. if ${MAKEINFO} --version \ - | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1; then + | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then : else MAKEINFO="$MISSING makeinfo" @@ -3647,7 +3664,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3651: checking for $ac_word" >&5 +echo "configure:3668: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3688,7 +3705,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3692: checking for $ac_word" >&5 +echo "configure:3709: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3736,7 +3753,7 @@ test -n "$target_alias" && ncn_target_tool_prefix=$target_alias- # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3740: checking for $ac_word" >&5 +echo "configure:3757: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3767,7 +3784,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3771: checking for $ac_word" >&5 +echo "configure:3788: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3811,7 +3828,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3815: checking for $ac_word" >&5 +echo "configure:3832: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3842,7 +3859,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3846: checking for $ac_word" >&5 +echo "configure:3863: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3886,7 +3903,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3890: checking for $ac_word" >&5 +echo "configure:3907: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3917,7 +3934,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3921: checking for $ac_word" >&5 +echo "configure:3938: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3961,7 +3978,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3965: checking for $ac_word" >&5 +echo "configure:3982: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3992,7 +4009,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3996: checking for $ac_word" >&5 +echo "configure:4013: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4036,7 +4053,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4040: checking for $ac_word" >&5 +echo "configure:4057: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4067,7 +4084,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4071: checking for $ac_word" >&5 +echo "configure:4088: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4111,7 +4128,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4115: checking for $ac_word" >&5 +echo "configure:4132: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4142,7 +4159,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4146: checking for $ac_word" >&5 +echo "configure:4163: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4186,7 +4203,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4190: checking for $ac_word" >&5 +echo "configure:4207: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4217,7 +4234,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4221: checking for $ac_word" >&5 +echo "configure:4238: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4256,7 +4273,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4260: checking for $ac_word" >&5 +echo "configure:4277: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4287,7 +4304,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4291: checking for $ac_word" >&5 +echo "configure:4308: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4326,7 +4343,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4330: checking for $ac_word" >&5 +echo "configure:4347: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4357,7 +4374,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4361: checking for $ac_word" >&5 +echo "configure:4378: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4401,7 +4418,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4405: checking for $ac_word" >&5 +echo "configure:4422: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4432,7 +4449,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4436: checking for $ac_word" >&5 +echo "configure:4453: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4476,7 +4493,7 @@ fi # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4480: checking for $ac_word" >&5 +echo "configure:4497: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4507,7 +4524,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4511: checking for $ac_word" >&5 +echo "configure:4528: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4571,7 +4588,7 @@ fi if test -n "$with_build_time_tools"; then for ncn_progname in cc gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4575: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4592: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4588,7 +4605,7 @@ if test -z "$ac_cv_prog_CC_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4592: checking for $ac_word" >&5 +echo "configure:4609: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4619,7 +4636,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4623: checking for $ac_word" >&5 +echo "configure:4640: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4662,7 +4679,7 @@ fi if test -n "$with_build_time_tools"; then for ncn_progname in c++ g++ cxx gxx; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4666: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4683: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4679,7 +4696,7 @@ if test -z "$ac_cv_prog_CXX_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4683: checking for $ac_word" >&5 +echo "configure:4700: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4710,7 +4727,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4714: checking for $ac_word" >&5 +echo "configure:4731: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4753,7 +4770,7 @@ fi if test -n "$with_build_time_tools"; then for ncn_progname in gcc; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4757: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4774: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4770,7 +4787,7 @@ if test -z "$ac_cv_prog_GCC_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4774: checking for $ac_word" >&5 +echo "configure:4791: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4801,7 +4818,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4805: checking for $ac_word" >&5 +echo "configure:4822: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4839,7 +4856,7 @@ fi if test -n "$with_build_time_tools"; then for ncn_progname in gcj; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4843: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4860: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4856,7 +4873,7 @@ if test -z "$ac_cv_prog_GCJ_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4860: checking for $ac_word" >&5 +echo "configure:4877: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4887,7 +4904,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4891: checking for $ac_word" >&5 +echo "configure:4908: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4930,7 +4947,7 @@ fi if test -n "$with_build_time_tools"; then for ncn_progname in gfortran; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:4934: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:4951: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -4947,7 +4964,7 @@ if test -z "$ac_cv_prog_GFORTRAN_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4951: checking for $ac_word" >&5 +echo "configure:4968: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4978,7 +4995,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4982: checking for $ac_word" >&5 +echo "configure:4999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5085,7 +5102,7 @@ rm conftest.c if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5089: checking for ar in $with_build_time_tools" >&5 +echo "configure:5106: checking for ar in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ar; then AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET @@ -5103,7 +5120,7 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5107: checking for $ac_word" >&5 +echo "configure:5124: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5140,7 +5157,7 @@ if test -z "$ac_cv_path_AR_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in ar; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5144: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5161: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5157,7 +5174,7 @@ if test -z "$ac_cv_prog_AR_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5161: checking for $ac_word" >&5 +echo "configure:5178: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5188,7 +5205,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5192: checking for $ac_word" >&5 +echo "configure:5209: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5238,7 +5255,7 @@ fi if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5242: checking for as in $with_build_time_tools" >&5 +echo "configure:5259: checking for as in $with_build_time_tools" >&5 if test -x $with_build_time_tools/as; then AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET @@ -5256,7 +5273,7 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5260: checking for $ac_word" >&5 +echo "configure:5277: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5293,7 +5310,7 @@ if test -z "$ac_cv_path_AS_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in as; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5297: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5314: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5310,7 +5327,7 @@ if test -z "$ac_cv_prog_AS_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5314: checking for $ac_word" >&5 +echo "configure:5331: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5341,7 +5358,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5345: checking for $ac_word" >&5 +echo "configure:5362: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5391,7 +5408,7 @@ fi if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5395: checking for dlltool in $with_build_time_tools" >&5 +echo "configure:5412: checking for dlltool in $with_build_time_tools" >&5 if test -x $with_build_time_tools/dlltool; then DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET @@ -5409,7 +5426,7 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5413: checking for $ac_word" >&5 +echo "configure:5430: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5446,7 +5463,7 @@ if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in dlltool; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5450: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5467: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5463,7 +5480,7 @@ if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5467: checking for $ac_word" >&5 +echo "configure:5484: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5494,7 +5511,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5498: checking for $ac_word" >&5 +echo "configure:5515: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5544,7 +5561,7 @@ fi if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5548: checking for ld in $with_build_time_tools" >&5 +echo "configure:5565: checking for ld in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ld; then LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET @@ -5562,7 +5579,7 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5566: checking for $ac_word" >&5 +echo "configure:5583: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5599,7 +5616,7 @@ if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in ld; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5603: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5620: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5616,7 +5633,7 @@ if test -z "$ac_cv_prog_LD_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5620: checking for $ac_word" >&5 +echo "configure:5637: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5647,7 +5664,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5651: checking for $ac_word" >&5 +echo "configure:5668: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5697,7 +5714,7 @@ fi if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5701: checking for lipo in $with_build_time_tools" >&5 +echo "configure:5718: checking for lipo in $with_build_time_tools" >&5 if test -x $with_build_time_tools/lipo; then LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET @@ -5715,7 +5732,7 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5719: checking for $ac_word" >&5 +echo "configure:5736: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5752,7 +5769,7 @@ if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in lipo; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5756: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5773: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5769,7 +5786,7 @@ if test -z "$ac_cv_prog_LIPO_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5773: checking for $ac_word" >&5 +echo "configure:5790: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5800,7 +5817,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5804: checking for $ac_word" >&5 +echo "configure:5821: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5850,7 +5867,7 @@ fi if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5854: checking for nm in $with_build_time_tools" >&5 +echo "configure:5871: checking for nm in $with_build_time_tools" >&5 if test -x $with_build_time_tools/nm; then NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET @@ -5868,7 +5885,7 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5872: checking for $ac_word" >&5 +echo "configure:5889: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5905,7 +5922,7 @@ if test -z "$ac_cv_path_NM_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in nm; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:5909: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:5926: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -5922,7 +5939,7 @@ if test -z "$ac_cv_prog_NM_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5926: checking for $ac_word" >&5 +echo "configure:5943: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5953,7 +5970,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5957: checking for $ac_word" >&5 +echo "configure:5974: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6003,7 +6020,7 @@ fi if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6007: checking for objdump in $with_build_time_tools" >&5 +echo "configure:6024: checking for objdump in $with_build_time_tools" >&5 if test -x $with_build_time_tools/objdump; then OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET @@ -6021,7 +6038,7 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6025: checking for $ac_word" >&5 +echo "configure:6042: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6058,7 +6075,7 @@ if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in objdump; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6062: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6079: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6075,7 +6092,7 @@ if test -z "$ac_cv_prog_OBJDUMP_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6079: checking for $ac_word" >&5 +echo "configure:6096: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6106,7 +6123,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6110: checking for $ac_word" >&5 +echo "configure:6127: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6156,7 +6173,7 @@ fi if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6160: checking for ranlib in $with_build_time_tools" >&5 +echo "configure:6177: checking for ranlib in $with_build_time_tools" >&5 if test -x $with_build_time_tools/ranlib; then RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET @@ -6174,7 +6191,7 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6178: checking for $ac_word" >&5 +echo "configure:6195: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6211,7 +6228,7 @@ if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in ranlib; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6215: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6232: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6228,7 +6245,7 @@ if test -z "$ac_cv_prog_RANLIB_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6232: checking for $ac_word" >&5 +echo "configure:6249: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6259,7 +6276,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6263: checking for $ac_word" >&5 +echo "configure:6280: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6309,7 +6326,7 @@ fi if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6313: checking for strip in $with_build_time_tools" >&5 +echo "configure:6330: checking for strip in $with_build_time_tools" >&5 if test -x $with_build_time_tools/strip; then STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET @@ -6327,7 +6344,7 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6331: checking for $ac_word" >&5 +echo "configure:6348: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6364,7 +6381,7 @@ if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in strip; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6368: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6385: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6381,7 +6398,7 @@ if test -z "$ac_cv_prog_STRIP_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6385: checking for $ac_word" >&5 +echo "configure:6402: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6412,7 +6429,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6416: checking for $ac_word" >&5 +echo "configure:6433: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6462,7 +6479,7 @@ fi if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6466: checking for windres in $with_build_time_tools" >&5 +echo "configure:6483: checking for windres in $with_build_time_tools" >&5 if test -x $with_build_time_tools/windres; then WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET @@ -6480,7 +6497,7 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6484: checking for $ac_word" >&5 +echo "configure:6501: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6517,7 +6534,7 @@ if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then for ncn_progname in windres; do echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 -echo "configure:6521: checking for ${ncn_progname} in $with_build_time_tools" >&5 +echo "configure:6538: checking for ${ncn_progname} in $with_build_time_tools" >&5 if test -x $with_build_time_tools/${ncn_progname}; then ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname} echo "$ac_t""yes" 1>&6 @@ -6534,7 +6551,7 @@ if test -z "$ac_cv_prog_WINDRES_FOR_TARGET"; then # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6538: checking for $ac_word" >&5 +echo "configure:6555: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6565,7 +6582,7 @@ fi # Extract the first word of "${ncn_progname}", so it can be a program name with args. set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6569: checking for $ac_word" >&5 +echo "configure:6586: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6613,7 +6630,7 @@ fi RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6 -echo "configure:6617: checking where to find the target ar" >&5 +echo "configure:6634: checking where to find the target ar" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6646,7 +6663,7 @@ else fi fi echo $ac_n "checking where to find the target as""... $ac_c" 1>&6 -echo "configure:6650: checking where to find the target as" >&5 +echo "configure:6667: checking where to find the target as" >&5 if test "x${build}" != "x${host}" ; then if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6679,7 +6696,7 @@ else fi fi echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6 -echo "configure:6683: checking where to find the target cc" >&5 +echo "configure:6700: checking where to find the target cc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6712,7 +6729,7 @@ else fi fi echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6 -echo "configure:6716: checking where to find the target c++" >&5 +echo "configure:6733: checking where to find the target c++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6748,7 +6765,7 @@ else fi fi echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6 -echo "configure:6752: checking where to find the target c++ for libstdc++" >&5 +echo "configure:6769: checking where to find the target c++ for libstdc++" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6784,7 +6801,7 @@ else fi fi echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6 -echo "configure:6788: checking where to find the target dlltool" >&5 +echo "configure:6805: checking where to find the target dlltool" >&5 if test "x${build}" != "x${host}" ; then if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6817,7 +6834,7 @@ else fi fi echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6 -echo "configure:6821: checking where to find the target gcc" >&5 +echo "configure:6838: checking where to find the target gcc" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6850,7 +6867,7 @@ else fi fi echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6 -echo "configure:6854: checking where to find the target gcj" >&5 +echo "configure:6871: checking where to find the target gcj" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6886,7 +6903,7 @@ else fi fi echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6 -echo "configure:6890: checking where to find the target gfortran" >&5 +echo "configure:6907: checking where to find the target gfortran" >&5 if test "x${build}" != "x${host}" ; then if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6922,7 +6939,7 @@ else fi fi echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6 -echo "configure:6926: checking where to find the target ld" >&5 +echo "configure:6943: checking where to find the target ld" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6955,7 +6972,7 @@ else fi fi echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6 -echo "configure:6959: checking where to find the target lipo" >&5 +echo "configure:6976: checking where to find the target lipo" >&5 if test "x${build}" != "x${host}" ; then if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -6978,7 +6995,7 @@ else fi fi echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6 -echo "configure:6982: checking where to find the target nm" >&5 +echo "configure:6999: checking where to find the target nm" >&5 if test "x${build}" != "x${host}" ; then if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7011,7 +7028,7 @@ else fi fi echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6 -echo "configure:7015: checking where to find the target objdump" >&5 +echo "configure:7032: checking where to find the target objdump" >&5 if test "x${build}" != "x${host}" ; then if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7044,7 +7061,7 @@ else fi fi echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6 -echo "configure:7048: checking where to find the target ranlib" >&5 +echo "configure:7065: checking where to find the target ranlib" >&5 if test "x${build}" != "x${host}" ; then if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7077,7 +7094,7 @@ else fi fi echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6 -echo "configure:7081: checking where to find the target strip" >&5 +echo "configure:7098: checking where to find the target strip" >&5 if test "x${build}" != "x${host}" ; then if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7110,7 +7127,7 @@ else fi fi echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6 -echo "configure:7114: checking where to find the target windres" >&5 +echo "configure:7131: checking where to find the target windres" >&5 if test "x${build}" != "x${host}" ; then if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then # We already found the complete path @@ -7171,7 +7188,7 @@ fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:7175: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:7192: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -7230,6 +7247,38 @@ case ${enable_werror} in esac +# Flags needed to enable html installing and building +# Check whether --with-datarootdir or --without-datarootdir was given. +if test "${with_datarootdir+set}" = set; then + withval="$with_datarootdir" + datarootdir="\${prefix}/${withval}" +else + datarootdir="\${prefix}/share" +fi + + +# Check whether --with-docdir or --without-docdir was given. +if test "${with_docdir+set}" = set; then + withval="$with_docdir" + docdir="\${prefix}/${withval}" +else + docdir="\${datarootdir}/doc" +fi + + +# Check whether --with-htmldir or --without-htmldir was given. +if test "${with_htmldir+set}" = set; then + withval="$with_htmldir" + htmldir="\${prefix}/${withval}" +else + htmldir="\${docdir}" +fi + + + + + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -7296,15 +7345,34 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed # Without the "./", some shells look in PATH for config.status. @@ -7475,6 +7543,9 @@ s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g s%@MAINT@%$MAINT%g s%@stage1_cflags@%$stage1_cflags%g s%@stage2_werror_flag@%$stage2_werror_flag%g +s%@datarootdir@%$datarootdir%g +s%@docdir@%$docdir%g +s%@htmldir@%$htmldir%g CEOF EOF diff --git a/configure.in b/configure.in index da7c63f..cdfa7d8 100644 --- a/configure.in +++ b/configure.in @@ -445,9 +445,6 @@ case "${target}" in *-*-vxworks*) noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}" ;; - m32c-*-*) - noconfigdirs="$noconfigdirs target-libstdc++-v3" - ;; alpha*-dec-osf*) # ld works, but does not support shared libraries. # newlib is not 64 bit ready. I'm not sure about fileutils. @@ -2129,6 +2126,20 @@ if test "x${use_gnu_ld}" = x && FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld' fi +# Search for other target-specific linker scripts and such. +case "${target}" in + m32c-*-* ) + if test -d ${srcdir}/libgloss/m32c; then + # This is for crt0.o + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/m32c' + # This is for r8c.ld + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/m32c' + # This is for libnosys.a + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys' + fi + ;; +esac + # Makefile fragments. for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag; do @@ -2203,10 +2214,10 @@ case " $build_configdirs " in *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;; *) changequote(,) - # For an installed makeinfo, we require it to be from texinfo 4.2 or + # For an installed makeinfo, we require it to be from texinfo 4.4 or # higher, else we use the "missing" dummy. if ${MAKEINFO} --version \ - | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1; then + | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then : else MAKEINFO="$MISSING makeinfo" @@ -2384,4 +2395,24 @@ case ${enable_werror} in esac AC_SUBST(stage2_werror_flag) +# Flags needed to enable html installing and building +AC_ARG_WITH(datarootdir, +[ --with-datarootdir Use datarootdir as the data root directory.], +[datarootdir="\${prefix}/${withval}"], +[datarootdir="\${prefix}/share"]) + +AC_ARG_WITH(docdir, +[ --with-docdir Install documentation in this directory.], +[docdir="\${prefix}/${withval}"], +[docdir="\${datarootdir}/doc"]) + +AC_ARG_WITH(htmldir, +[ --with-htmldir Install html in this directory.], +[htmldir="\${prefix}/${withval}"], +[htmldir="\${docdir}"]) + +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + AC_OUTPUT(Makefile) diff --git a/contrib/ChangeLog b/contrib/ChangeLog deleted file mode 100644 index 4a0de85..0000000 --- a/contrib/ChangeLog +++ /dev/null @@ -1,7 +0,0 @@ -2002-07-03 Nick Clifton - - * ChangeLog: Newly created. - * texi2pod.pl: Imported from FSF GCC sources. - - - diff --git a/contrib/texi2pod.pl b/contrib/texi2pod.pl deleted file mode 100755 index e5560f3..0000000 --- a/contrib/texi2pod.pl +++ /dev/null @@ -1,431 +0,0 @@ -#! /usr/bin/perl -w - -# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - -# This file is part of GNU CC. - -# GNU CC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# GNU CC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GNU CC; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston MA 02111-1307, USA. - -# This does trivial (and I mean _trivial_) conversion of Texinfo -# markup to Perl POD format. It's intended to be used to extract -# something suitable for a manpage from a Texinfo document. - -$output = 0; -$skipping = 0; -%sects = (); -$section = ""; -@icstack = (); -@endwstack = (); -@skstack = (); -@instack = (); -$shift = ""; -%defs = (); -$fnno = 1; -$inf = ""; -$ibase = ""; - -while ($_ = shift) { - if (/^-D(.*)$/) { - if ($1 ne "") { - $flag = $1; - } else { - $flag = shift; - } - $value = ""; - ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/); - die "no flag specified for -D\n" - unless $flag ne ""; - die "flags may only contain letters, digits, hyphens, dashes and underscores\n" - unless $flag =~ /^[a-zA-Z0-9_-]+$/; - $defs{$flag} = $value; - } elsif (/^-/) { - usage(); - } else { - $in = $_, next unless defined $in; - $out = $_, next unless defined $out; - usage(); - } -} - -if (defined $in) { - $inf = gensym(); - open($inf, "<$in") or die "opening \"$in\": $!\n"; - $ibase = $1 if $in =~ m|^(.+)/[^/]+$|; -} else { - $inf = \*STDIN; -} - -if (defined $out) { - open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; -} - -while(defined $inf) { -while(<$inf>) { - # Certain commands are discarded without further processing. - /^\@(?: - [a-z]+index # @*index: useful only in complete manual - |need # @need: useful only in printed manual - |(?:end\s+)?group # @group .. @end group: ditto - |page # @page: ditto - |node # @node: useful only in .info file - |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents - )\b/x and next; - - chomp; - - # Look for filename and title markers. - /^\@setfilename\s+([^.]+)/ and $fn = $1, next; - /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; - - # Identify a man title but keep only the one we are interested in. - /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { - if (exists $defs{$1}) { - $fn = $1; - $tl = postprocess($2); - } - next; - }; - - # Look for blocks surrounded by @c man begin SECTION ... @c man end. - # This really oughta be @ifman ... @end ifman and the like, but such - # would require rev'ing all other Texinfo translators. - /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { - $output = 1 if exists $defs{$2}; - $sect = $1; - next; - }; - /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next; - /^\@c\s+man\s+end/ and do { - $sects{$sect} = "" unless exists $sects{$sect}; - $sects{$sect} .= postprocess($section); - $section = ""; - $output = 0; - next; - }; - - # handle variables - /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { - $defs{$1} = $2; - next; - }; - /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { - delete $defs{$1}; - next; - }; - - next unless $output; - - # Discard comments. (Can't do it above, because then we'd never see - # @c man lines.) - /^\@c\b/ and next; - - # End-block handler goes up here because it needs to operate even - # if we are skipping. - /^\@end\s+([a-z]+)/ and do { - # Ignore @end foo, where foo is not an operation which may - # cause us to skip, if we are presently skipping. - my $ended = $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; - - die "\@end $ended without \@$ended at line $.\n" unless defined $endw; - die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; - - $endw = pop @endwstack; - - if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { - $skipping = pop @skstack; - next; - } elsif ($ended =~ /^(?:example|smallexample|display)$/) { - $shift = ""; - $_ = ""; # need a paragraph break - } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { - $_ = "\n=back\n"; - $ic = pop @icstack; - } else { - die "unknown command \@end $ended at line $.\n"; - } - }; - - # We must handle commands which can cause skipping even while we - # are skipping, otherwise we will not process nested conditionals - # correctly. - /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw = "ifset"; - $skipping = 1 unless exists $defs{$1}; - next; - }; - - /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw = "ifclear"; - $skipping = 1 if exists $defs{$1}; - next; - }; - - /^\@(ignore|menu|iftex)\b/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw = $1; - $skipping = 1; - next; - }; - - next if $skipping; - - # Character entities. First the ones that can be replaced by raw text - # or discarded outright: - s/\@copyright\{\}/(c)/g; - s/\@dots\{\}/.../g; - s/\@enddots\{\}/..../g; - s/\@([.!? ])/$1/g; - s/\@[:-]//g; - s/\@bullet(?:\{\})?/*/g; - s/\@TeX\{\}/TeX/g; - s/\@pounds\{\}/\#/g; - s/\@minus(?:\{\})?/-/g; - s/\\,/,/g; - - # Now the ones that have to be replaced by special escapes - # (which will be turned back into text by unmunge()) - s/&/&/g; - s/\@\{/{/g; - s/\@\}/}/g; - s/\@\@/&at;/g; - - # Inside a verbatim block, handle @var specially. - if ($shift ne "") { - s/\@var\{([^\}]*)\}/<$1>/g; - } - - # POD doesn't interpret E<> inside a verbatim block. - if ($shift eq "") { - s//>/g; - } else { - s//>/g; - } - - # Single line command handlers. - - /^\@include\s+(.+)$/ and do { - push @instack, $inf; - $inf = gensym(); - - # Try cwd and $ibase. - open($inf, "<" . $1) - or open($inf, "<" . $ibase . "/" . $1) - or die "cannot open $1 or $ibase/$1: $!\n"; - next; - }; - - /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ - and $_ = "\n=head2 $1\n"; - /^\@subsection\s+(.+)$/ - and $_ = "\n=head3 $1\n"; - - # Block command handlers: - /^\@itemize\s+(\@[a-z]+|\*|-)/ and do { - push @endwstack, $endw; - push @icstack, $ic; - $ic = $1; - $_ = "\n=over 4\n"; - $endw = "itemize"; - }; - - /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do { - push @endwstack, $endw; - push @icstack, $ic; - if (defined $1) { - $ic = $1 . "."; - } else { - $ic = "1."; - } - $_ = "\n=over 4\n"; - $endw = "enumerate"; - }; - - /^\@([fv]?table)\s+(\@[a-z]+)/ and do { - push @endwstack, $endw; - push @icstack, $ic; - $endw = $1; - $ic = $2; - $ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/; - $ic =~ s/\@(?:code|kbd)/C/; - $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; - $ic =~ s/\@(?:file)/F/; - $_ = "\n=over 4\n"; - }; - - /^\@((?:small)?example|display)/ and do { - push @endwstack, $endw; - $endw = $1; - $shift = "\t"; - $_ = ""; # need a paragraph break - }; - - /^\@itemx?\s*(.+)?$/ and do { - if (defined $1) { - # Entity escapes prevent munging by the <> processing below. - $_ = "\n=item $ic\<$1\>\n"; - } else { - $_ = "\n=item $ic\n"; - $ic =~ y/A-Ya-y/B-Zb-z/; - $ic =~ s/(\d+)/$1 + 1/eg; - } - }; - - $section .= $shift.$_."\n"; -} -# End of current file. -close($inf); -$inf = pop @instack; -} - -die "No filename or title\n" unless defined $fn && defined $tl; - -$sects{NAME} = "$fn \- $tl\n"; -$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; - -for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES - BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { - if(exists $sects{$sect}) { - $head = $sect; - $head =~ s/SEEALSO/SEE ALSO/; - print "=head1 $head\n\n"; - print scalar unmunge ($sects{$sect}); - print "\n"; - } -} - -sub usage -{ - die "usage: $0 [-D toggle...] [infile [outfile]]\n"; -} - -sub postprocess -{ - local $_ = $_[0]; - - # @value{foo} is replaced by whatever 'foo' is defined as. - while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) { - if (! exists $defs{$2}) { - print STDERR "Option $2 not defined\n"; - s/\Q$1\E//; - } else { - $value = $defs{$2}; - s/\Q$1\E/$value/; - } - } - - # Formatting commands. - # Temporary escape for @r. - s/\@r\{([^\}]*)\}/R<$1>/g; - s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g; - s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g; - s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g; - s/\@sc\{([^\}]*)\}/\U$1/g; - s/\@file\{([^\}]*)\}/F<$1>/g; - s/\@w\{([^\}]*)\}/S<$1>/g; - s/\@(?:dmn|math)\{([^\}]*)\}/$1/g; - - # Cross references are thrown away, as are @noindent and @refill. - # (@noindent is impossible in .pod, and @refill is unnecessary.) - # @* is also impossible in .pod; we discard it and any newline that - # follows it. Similarly, our macro @gol must be discarded. - - s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; - s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; - s/;\s+\@pxref\{(?:[^\}]*)\}//g; - s/\@noindent\s*//g; - s/\@refill//g; - s/\@gol//g; - s/\@\*\s*\n?//g; - - # @uref can take one, two, or three arguments, with different - # semantics each time. @url and @email are just like @uref with - # one argument, for our purposes. - s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; - s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; - s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; - - # Un-escape <> at this point. - s/<//g; - - # Now un-nest all B<>, I<>, R<>. Theoretically we could have - # indefinitely deep nesting; in practice, one level suffices. - 1 while s/([BIR])<([^<>]*)([BIR])<([^<>]*)>/$1<$2>$3<$4>$1 with bare ...; eliminate empty markup, B<>; - # shift white space at the ends of [BI]<...> expressions outside - # the expression. - s/R<([^<>]*)>/$1/g; - s/[BI]<>//g; - s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g; - s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g; - - # Extract footnotes. This has to be done after all other - # processing because otherwise the regexp will choke on formatting - # inside @footnote. - while (/\@footnote/g) { - s/\@footnote\{([^\}]+)\}/[$fnno]/; - add_footnote($1, $fnno); - $fnno++; - } - - return $_; -} - -sub unmunge -{ - # Replace escaped symbols with their equivalents. - local $_ = $_[0]; - - s/</E/g; - s/>/E/g; - s/{/\{/g; - s/}/\}/g; - s/&at;/\@/g; - s/&/&/g; - return $_; -} - -sub add_footnote -{ - unless (exists $sects{FOOTNOTES}) { - $sects{FOOTNOTES} = "\n=over 4\n\n"; - } - - $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; - $sects{FOOTNOTES} .= $_[0]; - $sects{FOOTNOTES} .= "\n\n"; -} - -# stolen from Symbol.pm -{ - my $genseq = 0; - sub gensym - { - my $name = "GEN" . $genseq++; - my $ref = \*{$name}; - delete $::{$name}; - return $ref; - } -} diff --git a/cpu/ChangeLog b/cpu/ChangeLog index 2a888e0..c0019d8 100644 --- a/cpu/ChangeLog +++ b/cpu/ChangeLog @@ -1,3 +1,17 @@ +2006-04-10 DJ Delorie + + * m32c.opc (parse_unsigned_bitbase): Take a new parameter which + decides if this function accepts symbolic constants or not. + (parse_signed_bitbase): Likewise. + (parse_unsigned_bitbase8): Pass the new parameter. + (parse_unsigned_bitbase11): Likewise. + (parse_unsigned_bitbase16): Likewise. + (parse_unsigned_bitbase19): Likewise. + (parse_unsigned_bitbase27): Likewise. + (parse_signed_bitbase8): Likewise. + (parse_signed_bitbase11): Likewise. + (parse_signed_bitbase19): Likewise. + 2006-03-13 DJ Delorie * m32c.cpu (Bit3-S): New. diff --git a/cpu/m32c.opc b/cpu/m32c.opc index f664e9a..6b9ef11 100644 --- a/cpu/m32c.opc +++ b/cpu/m32c.opc @@ -608,13 +608,14 @@ parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp, static const char * parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep, - unsigned bits) + unsigned bits, int allow_syms) { const char *errmsg = 0; unsigned long bit; unsigned long base; const char *newp = *strp; unsigned long long bitbase; + long have_zero = 0; errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); if (errmsg) @@ -624,6 +625,11 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, return "Missing base for bit,base:8"; ++newp; + + if (strncmp (newp, "0x0", 3) == 0 + || (newp[0] == '0' && newp[1] != 'x')) + have_zero = 1; + errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base); if (errmsg) return errmsg; @@ -633,6 +639,21 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, if (bitbase >= (1ull << bits)) return _("bit,base is out of range"); + /* If this field may require a relocation then use larger displacement. */ + if (! have_zero && base == 0) + { + switch (allow_syms) { + case 0: + return _("bit,base out of range for symbol"); + case 1: + break; + case 2: + if (strncmp (newp, "[sb]", 4) != 0) + return _("bit,base out of range for symbol"); + break; + } + } + *valuep = bitbase; *strp = newp; return 0; @@ -641,7 +662,7 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, static const char * parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep, - unsigned bits) + unsigned bits, int allow_syms) { const char *errmsg = 0; unsigned long bit; @@ -649,6 +670,7 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, const char *newp = *strp; long long bitbase; long long limit; + long have_zero = 0; errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); if (errmsg) @@ -658,6 +680,11 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, return "Missing base for bit,base:8"; ++newp; + + if (strncmp (newp, "0x0", 3) == 0 + || (newp[0] == '0' && newp[1] != 'x')) + have_zero = 1; + errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base); if (errmsg) return errmsg; @@ -668,6 +695,10 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, if (bitbase < -limit || bitbase >= limit) return _("bit,base is out of range"); + /* If this field may require a relocation then use larger displacement. */ + if (! have_zero && base == 0 && ! allow_syms) + return _("bit,base out of range for symbol"); + *valuep = bitbase; *strp = newp; return 0; @@ -677,56 +708,56 @@ static const char * parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8, 0); } static const char * parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11, 0); } static const char * parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16, 1); } static const char * parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19, 2); } static const char * parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27, 1); } static const char * parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { - return parse_signed_bitbase (cd, strp, opindex, valuep, 8); + return parse_signed_bitbase (cd, strp, opindex, valuep, 8, 1); } static const char * parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { - return parse_signed_bitbase (cd, strp, opindex, valuep, 11); + return parse_signed_bitbase (cd, strp, opindex, valuep, 11, 0); } static const char * parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { - return parse_signed_bitbase (cd, strp, opindex, valuep, 19); + return parse_signed_bitbase (cd, strp, opindex, valuep, 19, 1); } /* Parse the suffix as : or as nothing followed by a whitespace. */ diff --git a/etc/ChangeLog b/etc/ChangeLog index 64fdee6..0d2b80c 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,11 @@ +2006-04-06 Carlos O'Donell + + * Makefile.in: Add install-html target. Add htmldir, + docdir and datarootdir. + * configure.texi: Document install-html target. + * configure.in: AC_SUBST datarootdir, docdir, htmldir. + * configure: Regenerate. + 2006-02-27 Carlos O'Donell * Makefile.in: TEXI2HTML uses makeinfo. Define diff --git a/etc/Makefile.in b/etc/Makefile.in index df461cf..7d0607d 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -25,7 +25,10 @@ man6dir = $(mandir)/man6 man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 man9dir = $(mandir)/man9 +datarootdir = @datarootdir@ +docdir = @docdir@ infodir = @infodir@ +htmldir = @htmldir@ SHELL = /bin/sh @@ -97,6 +100,20 @@ html: fi; \ done +install-html: html + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(htmldir) + if test ! -f standards.html; then cd $(srcdir); fi; \ + if test -f standards.html; then \ + for i in standards.html*; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(htmldir)/$$i; \ + done; \ + fi + if test ! -f configure.html; then cd $(srcdir); fi; \ + if test -f configure.html; then \ + for i in configure.html*; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(htmldir)/$$i; \ + done; \ + fi dvi: for f in $(DVIFILES); do \ diff --git a/etc/configure b/etc/configure index 101fcef..82033e9 100755 --- a/etc/configure +++ b/etc/configure @@ -1,26 +1,288 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.59. # +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi -# Defaults: -ac_help= +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="Makefile.in" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA datarootdir docdir htmldir LIBOBJS LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -29,10 +291,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -46,17 +313,9 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -64,59 +323,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -125,95 +384,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -222,19 +433,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -248,26 +459,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -284,7 +495,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -294,7 +505,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -305,58 +516,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -367,99 +577,110 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=Makefile.in # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -469,13 +690,422 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -486,38 +1116,104 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file fi -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac fi -else - ac_n= ac_c='\c' ac_t= +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + ac_aux_dir= @@ -530,14 +1226,20 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -546,317 +1248,993 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:555: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -trap '' 1 2 15 -cat > confcache <<\EOF + + + + + + ac_config_files="$ac_config_files Makefile" +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.1" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi done -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS </dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` + as_ln_s='ln -s' fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" fi -EOF -cat >> $CONFIG_STATUS <>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; esac +done - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi +fi # test -n "$CONFIG_FILES" - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +cat >>$CONFIG_STATUS <<\_ACEOF -exit 0 -EOF +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/etc/configure.in b/etc/configure.in index b785068..38bc659 100644 --- a/etc/configure.in +++ b/etc/configure.in @@ -4,4 +4,9 @@ AC_INIT(Makefile.in) AC_PROG_INSTALL +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + + AC_OUTPUT(Makefile) diff --git a/etc/configure.texi b/etc/configure.texi index 385a7c4..58c5285 100644 --- a/etc/configure.texi +++ b/etc/configure.texi @@ -276,7 +276,9 @@ directory is controlled by @samp{configure} options, as described below. In the Cygnus tree at present, the info files are built and installed as a separate step. To build them, run @samp{make info}. To install them, -run @samp{make install-info}. +run @samp{make install-info}. The equivalent html files are also built +and installed in a separate step. To build the html files, run +@samp{make html}. To install the html files run @samp{make install-html}. All @samp{configure} scripts support a wide variety of options. The most interesting ones are @samp{--with} and @samp{--enable} options diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 69d3ba7..dcb436b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,409 @@ +2006-04-20 Daniel Jacobowitz + + * m68klinux-tdep.c (m68k_linux_sigtramp_frame_prev_register): + Correct type of VALUEP. Reported by Jean-Rene Peulve + . + +2006-04-19 Masaki Muranaka + + * m32r-rom.c: On MinGW, include winsock.h instead of sys/types.h, + netdb.h, netinet/in.h. + (m32r_upload_command); Add calls WSAStartup(). + * remote-m32r-sdi.c: On MinGW, include winsock.h instead of + netinet/in.h. + +2006-04-18 Daniel Jacobowitz + + * breakpoint.c (deprecated_read_memory_nobpt): Update to use + shadow_len. + (insert_bp_location, reattach_breakpoints, remove_breakpoint) + (delete_breakpoint): Update calls to changed methods. + (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) + (single_step_breakpoints, insert_single_step_breakpoint) + (remove_single_step_breakpoints): New. + * breakpoint.h (struct bp_target_info): New. + (struct bp_location): Replace shadow_contents with + target_info and overlay_target_info. + (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) + (insert_single_step_breakpoint, remove_single_step_breakpoints): New + prototypes. + * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. + (memory_insert_breakpoint, memory_remove_breakpoint): Update second + argument. + * mem-break.c (default_memory_insert_breakpoint): Update. Set + placed_address, placed_size, and shadow_len. + (default_memory_remove_breakpoint): Update. Don't use + BREAKPOINT_FROM_PC. + (memory_insert_breakpoint, memory_remove_breakpoint): Update. + * target.c (update_current_target): Update prototypes for changed + functions. + (debug_to_insert_breakpoint, debug_to_remove_breakpoint) + (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): + Update. + * target.h: Forward declare struct bp_target_info. + (struct target_ops): Use a bp_target_info argument for + to_insert_breakpoint, to_remove_breakpoint, + to_insert_hw_breakpoint, and to_remove_hw_breakpoint. + (target_insert_breakpoint, target_remove_breakpoint) + (target_insert_hw_breakpoint, target_remove_hw_breakpoint) + (memory_insert_breakpoint, memory_remove_breakpoint) + (default_memory_insert_breakpoint, default_memory_remove_breakpoint): + Update. + * config/i386/nm-i386.h: Forward declare struct bp_target_info. + (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. + (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. + + * gdbarch.c, gdbarch.h: Regenerated. + + * alpha-tdep.c (alpha_software_single_step): Use + insert_single_step_breakpoint and remove_single_step_breakpoints. + Remove unused statics. + * arm-tdep.c (arm_software_single_step): Likewise. Add a note. + * cris-tdep.c (cris_software_single_step): Likewise. + * mips-tdep.c (mips_software_single_step): Likewise. + * rs6000-tdep.c (rs6000_software_single_step): Likewise. + * sparc-tdep.c (sparc_software_single_step): Likewise. + * wince.c (struct thread_info_struct): Remove step_prev. + (undoSStep): Use remove_single_step_breakpoints. + (wince_software_single_step): Use insert_single_step_breakpoint. + + * corelow.c (ignore): Remove unneeded prototype. Update arguments. + * exec.c (ignore): Likewise. + * sol-thread.c (ignore): Likewise. + + * procfs.c (dbx_link_shadow_contents): Delete. + (dbx_link_bpt): New. + (procfs_mourn_inferior): Remove it if necessary. + (remove_dbx_link_breakpoint): Use it. + (insert_dbx_link_bpt_in_file): Set it. + (procfs_init_inferior): Don't update dbx_link_bpt_addr. + * rs6000-nat.c (exec_one_dummy_insn): Use + deprecated_insert_raw_breakpoint and + deprecated_remove_raw_breakpoint. + * solib-irix.c (shadow_contents, breakpoint_addr): Delete. + (base_breakpoint): New. + (disable_break): Use it. + (enable_break): Set it. + + * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): + Update. + * ia64-tdep.c (ia64_memory_insert_breakpoint) + (ia64_memory_remove_breakpoint): Likewise. + * m32r-tdep.c (m32r_memory_insert_breakpoint) + (m32r_memory_remove_breakpoint): Likewise. + * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): + Likewise. Remove unnecessary prototypes. Use placed_address + and placed_size. Removed useless read from memory. + * nto-procfs.c (procfs_insert_breakpoint) + (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) + (procfs_remove_hw_breakpoint): Update. + * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. + * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. + * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. + * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. + * remote-e7000.c (e7000_insert_breakpoint) + (e7000_remove_breakpoint): Likewise. + * remote-m32r-sdi.c (m32r_insert_breakpoint) + (m32r_remove_breakpoint): Likewise. + * remote-mips.c (mips_insert_breakpoint) + (mips_remove_breakpoint): Likewise. + * remote-rdp.c (remote_rdp_insert_breakpoint) + (remote_rdp_remove_breakpoint): Likewise. + (rdp_step): Use deprecated_insert_raw_breakpoint and + deprecated_remove_raw_breakpoint. + * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): + Update. + * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): + Delete. + (init_gdbsim_ops): Use memory_insert_breakpoint and + memory_remove_breakpoint. + * remote-st.c (st2000_insert_breakpoint) + (st2000_remove_breakpoint): Update. Remove unused + BREAKPOINT_FROM_PC. + * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): + Update. Use placed_address and placed_size. + (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. + +2006-04-12 Daniel Jacobowitz + + * remote.c (extended_remote_restart): Pass the correct length + to getpkt. + +2006-04-11 Jim Blandy + + * serial.c (serial_open): Check for special cases at the front of + the "device" name before scanning for the ':' that would indicate + an IP-based connection. + +2006-04-10 Christopher Faylor + + * win32-nat.c (open_symbol_file_object): New function. + (in_dynsym_resolve_code): Ditto. + (init_win32_ops): Fill in fields which ought not to be NULL. + +2006-04-10 Christopher Faylor + + * win32-nat.c (do_win32_fetch_inferior_registers): Don't do anything + with saved context if __COPY_CONTEXT_SIZE is not defined. + (handle_output_debug_string): Ditto. + +2006-04-10 Daniel Jacobowitz + + * arm-linux-tdep.c (arm_linux_extract_return_value): Use gdb_byte. + +2006-04-09 David S. Miller + + * sparc64-linux-tdep.c (sparc64_linux_init_abi): Append dwarf2 + frame sniffer. + * sparc-tdep.c (sparc32_gdbarch_init): Make sure to call + dwarf2_frame_set_init_reg() before gdbarch_init_osabi() so + that the latter can override. + * Makefile.in (sparc64-linux-tdep.o): Update dependencies. + +2006-04-09 Ulrich Weigand + + * s390-tdep.c (struct s390_prologue_data): New field 'stack'. + (s390_store): Call pv_area_store to track stack slots. + (s390_load): Call pv_area_fetch to track stack slots. + (s390_check_for_saved): New function. + (s390_analyze_prologue): Call pv_area_scan. Allocate and free stack. + +2006-04-09 Ulrich Weigand + + * Makefile.in (s390-tdep.o): Add dependency on $(prologue_value_h). + * s390-tdep.c: Include "prologue-value.h". + (struct prologue_value): Remove. + (pv_set_to_unknown, pv_set_to_constant, pv_set_to_register, + pv_constant_last, pv_add, pv_add_constant, pv_subtract, + pv_logical_and, pv_is_identical, pv_is_register): Remove. + (compute_x_addr): Remove, replace by ... + (s390_addr): ... this new function. + (struct s390_prologue_data): Use pv_t instead of prologue_value. + (s390_store, s390_load): Likewise. + (s390_prologue_frame_unwind_cache): Likewise. + (s390_analyze_prologue): Likewise. Also, simplify and combine + several conditional statements. + +2006-04-08 Jim Blandy + + * Makefile.in (COMMON_OBS): List prologue-value.o. (Omitted from + last patch.) + +2006-04-08 David S. Miller + + * sparc-linux-tdep.c (sparc32_linux_step_trap): New. + (sparc32_linux_init_abi): Hook it into tdep->step_trap. + (sparc32_linux_core_gregset, + sparc32_linux_supply_core_gregset, + sparc32_linux_collect_core_gregset, + sparc32_linux_supply_core_fpregset, + sparc32_linux_collect_core_fpregset): New. + (sparc32_linux_init_abi): Register them with generic sparc + core regset infrastructure. + * sparc64-linux-tdep.c (sparc64_linux_step_trap): New. + (sparc64_linux_init_abi): Hook it into tdep->step_trap. + (sparc64_linux_core_gregset, + sparc64_linux_supply_core_gregset, + sparc64_linux_collect_core_gregset, + sparc64_linux_supply_core_fpregset, + sparc64_linux_collect_core_fpregset): New. + (sparc64_linux_init_abi): Register them with generic sparc + core regset infrastructure. + * Makefile.in: Update dependencies. + +2006-04-07 David S. Miller + + * linux-nat.c (linux_nat_thread_alive): Handle targets that + do not implement PTRACE_PEEKUSER. + +2006-04-07 Daniel Jacobowitz + + * remote.c (remote_wait): Convert warning to error before + parsing corrupt packets. + +2006-04-07 Andrew Stubbs + + * cli/cli-script.c (struct user_args): Add command field. + (arg_cleanup): Free command string. + (setup_user_args): Copy the command line before relying on it. + +2006-04-06 Joel Brobecker + + * breakpoint.c (_initialize_breakpoint): Add "del" as an alias + of the "delete" command. + +2006-04-06 Randolph Chung + + * MAINTAINERS (Patch champions): Add myself. + +2006-04-05 Andreas Schwab + + * Makefile.in: Update dependencies. + +2006-04-05 David S. Miller + + * sparc-tdep.c (sparc32_dwarf2_frame_init_reg): New. + (sparc32_gdbarch_init): Pass it to dwarf2_frame_set_init_reg. + * Makefile.in (sparc-tdep.o): Update dependencies. + * sparc-linux-tdep.c (sparc32_linux_sigframe_init): Pull register + window out of the correct stack frame. + * sparc64-linux-tdep.c (sparc64_linux_sigframe_init): Likewise. + * dwarf2-frame.c (dwarf2_frame_ops init_reg): Add "next_frame" + argument. + (dwarf2_frame_default_init_reg): Likewise. + (dwarf2_frame_set_init_reg): Update init_reg arg. + (dwarf2_frame_init_reg): Take "next_frame" and pass it to + ops->init_reg(). + (dwarf2_frame_cache): Pass next_frame to dwarf2_frame_init_reg. + * dwarf2-frame.h (dwarf2-frame_set_init_reg): Update declaration. + * cris-tdep.c (cris_dwarf2_frame_init_reg): Add next_frame arg. + * s390-tdep.c (s390_dwarf2_frame_init_reg): Likewise. + * sh-tdep.c (sh_dwarf2_frame_init_reg): Likewise. + * sparc64-tdep.c (sparc64_dwarf2_frame_init_reg): Likewise. + * sparc-tdep.c (sparc32_struct_return_from_sym): New function. + (sparc32_frame_cache): Call it. + (sparc32_dwarf2_struct_return_p): New function. + (sparc_dwarf2_frame_init_reg): Use it to determine if the function + returns a structure and thus we have to indicate the return PC and + NPC are 4 bytes later than usual. + * sparc-linux-tdep.c (sparc32_linux_init_abi): Append + dwarf2 frame sniffer. + * Makefile.in (sparc-linux-tdep.o): Update dependencies. + +2006-04-04 David S. Miller + + * config/linux.mh (NATDEPFILES): Remove sparc-sol2-nat.o + * config/linux64.h (NATDEPFILES): Likewise + * sparc-linux-nat.c (supply_gregset, supply_fpregset, fill_gregset, + fill_fpregset): New. + * sparc64-linux-nat.c (supply_gregset, supply_fpregset, fill_gregset, + fill_fpregset): New. + * Makefile.in (sparc-linux-nat.o, sparc64-linux-nat.o): Update for + new includes. + +2006-04-04 Andreas Schwab + + * Makefile.in (elf_common_h): Define. + +2006-04-03 Andrew Stubbs + + * sh-tdep.c (sh_dwarf2_frame_init_reg): New function. + (sh_gdbarch_init): Call dwarf2_frame_set_init_reg(). + +2006-03-31 Andrew Stubbs + + * value.h (struct internalvar): Add field 'endian'. + * value.c (lookup_internalvar): Initialise endian. + (value_of_internalvar): Flip the endian of built-in types if required. + (set_internalvar): Set the endian. + (show_convenience): Access the value through value_of_internalvar(). + +2006-03-30 Vladimir Prus + + * remote.c (watchpoint_to_Z_packet): Use values of Z_packet_type enum + instead of hardcoded integer literals. + +2006-03-30 Daniel Jacobowitz + + * cli/cli-script.c (insert_args): Handle NULL user_args. + +2006-03-30 Daniel Jacobowitz + + * arm-tdep.c (thumb_scan_prologue): Don't try to analyze + the function at zero if we have no symbols. + +2006-03-30 Adrien Kunysz + + * i386-stub.c (getpacket): Fix array overflow. + * m32r-stub.c (getpacket): Likewise. + * m68k-stub.c (getpacket): Likewise. + * sh-stub.c (getpacket): Likewise. + * sparc-stub.c (getpacket): Likewise. + +2006-03-30 Daniel Jacobowitz + + * frame.h (set_current_sal_from_frame): New prototype. + * stack.c (set_current_sal_from_frame): Make global. + * infrun.c (normal_stop): Call set_current_sal_from_frame. + +2006-03-30 Daniel Jacobowitz + + * linux-thread-db.c: Include "linux-nat.h". + (check_for_thread_db): New function, split out from + thread_db_new_objfile. Remove dead check for active + thread_db on inapplicable targets. + (thread_db_new_objfile): Call check_for_thread_db. + * Makefile.in (linux-thread-db.o): Update. + * linux-nat.c (child_post_attach): Call check_for_thread_db. + (linux_child_post_startup_inferior): Likewise. + (lin_lwp_attach_lwp): Call target_post_attach instead of + child_post_attach. + * linux-nat.h (check_for_thread_db): New prototype. + +2006-03-30 Daniel Jacobowitz + + * remote.c (struct remote_state): Add BUF and BUF_SIZE. + (init_remote_state): Initialize the new fields. + (get_memory_packet_size): Update BUF and BUF_SIZE if necessary. + (set_thread, remote_thread_alive, remote_unpack_thread_info_response) + (remote_get_threadinfo, parse_threadlist_response) + (remote_get_threadlist, remote_current_thread, remote_threads_info) + (remote_threads_extra_info, extended_remote_restart, get_offsets) + (remote_check_symbols, remote_open_1, remote_detach) + (remove_vcont_probe, remote_vcont_resume, remote_resume) + (remote_wait, remote_async_wait, fetch_register_using_p) + (remote_fetch_registers, store_register_using_P) + (remote_store_registers, check_binary_download, remote_write_bytes) + (remote_read_bytes, remote_insert_breakpoint) + (remote_remove_breakpoint, remote_insert_watchpoint) + (remote_remove_watchpoint, remote_insert_hw_breakpoint) + (remote_remove_hw_breakpoint, compare_sections_command) + (remote_xfer_partial, remote_rcmd, packet_command) + (remote_get_thread_local_address): Use the global incoming buffer + instead of alloca or xmalloc. Limit outgoing packets to + rs->remote_packet_size and incoming packets to rs->buf_size. + Update calls to getpkt and remote_send. + (remote_send): Take arguments by reference. + (putpkt_binary): Eliminate junkbuf. Use skip_frame. + (skip_frame): New function. + (read_frame): Take arguments by reference. Expand the packet + buffer instead of issuing an error. + (getpkt, getpkt_sane): Take arguments by reference. + * remote.h (getpkt): Update prototype and doc. + * tracepoint.c (remote_get_noisy_reply): Take arguments by + reference. + (target_buf): Change from array to pointer. + (target_buf_size): New variable. + (remote_set_transparent_ranges): Update call to getpkt. + (trace_start_command, trace_stop_command, trace_status_command): + Update calls to remote_get_noisy_reply. + (finish_tfind_command): Take arguments by reference. + (trace_find_command, trace_find_pc_command) + (trace_find_tracepoint_command, trace_find_line_command): + (trace_find_range_command, trace_find_outside_command): Update + calls to finish_tfind_command. + (_initialize_tracepoint): Initialize target_buf_size and target_buf. + +2005-03-30 Randolph Chung + + * hppa-linux-tdep.c: Include regset.h. + (GR_REGNUM, TR_REGNUM, greg_map): New. + (hppa_linux_supply_regset, hppa_linux_supply_fpregset): New. + (hppa_linux_regset, hppa_linux_fpregset): New. + (hppa_linux_regset_from_core_section): New. + (hppa_linux_init_abi): Set regset_from_core_section. + (_initialize_hppa_linux_tdep): Register osabi handler for + 64-bit Linux. + * Makefile.in (hppa-linux-tdep.o): Update dependencies. + * config/pa/linux.mh: Stop using core-regset.o + +2006-03-30 Randolph Chung + + * hppa-tdep.c (hppa_find_unwind_entry_in_block): New. + (hppa_frame_cache): Use new function to find unwind entry. + (hppa_frame_this_id): Likewise. + (hppa_frame_unwind_sniffer): Likewise. + 2006-03-29 Daniel Jacobowitz * NEWS: Mention the removal of NLM. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 59b93c9..dbd2f93 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -192,6 +192,7 @@ patches; and ensure that contributors are given credit. Current patch champions (in alphabetical order): + Randolph Chung Daniel Jacobowitz diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 644e9d9..beab57c 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -576,6 +576,7 @@ coff_symconst_h = $(INCLUDE_DIR)/coff/symconst.h coff_ecoff_h = $(INCLUDE_DIR)/coff/ecoff.h coff_internal_h = $(INCLUDE_DIR)/coff/internal.h dis_asm_h = $(INCLUDE_DIR)/dis-asm.h $(bfd_h) +elf_common_h = $(INCLUDE_DIR)/elf/common.h elf_reloc_macros_h = $(INCLUDE_DIR)/elf/reloc-macros.h elf_sh_h = $(INCLUDE_DIR)/elf/sh.h elf_arm_h = $(INCLUDE_DIR)/elf/arm.h $(elf_reloc_macros_h) @@ -951,7 +952,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ reggroups.o regset.o \ trad-frame.o \ tramp-frame.o \ - solib.o solib-null.o + solib.o solib-null.o \ + prologue-value.o TSOBS = inflow.o @@ -2033,7 +2035,7 @@ hppa-linux-nat.o: hppa-linux-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \ hppa-linux-tdep.o: hppa-linux-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \ $(target_h) $(objfiles_h) $(solib_svr4_h) $(glibc_tdep_h) \ $(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \ - $(hppa_tdep_h) $(elf_common_h) + $(hppa_tdep_h) $(elf_common_h) $(regset_h) hppa-tdep.o: hppa-tdep.c $(defs_h) $(bfd_h) $(inferior_h) $(regcache_h) \ $(completer_h) $(osabi_h) $(gdb_assert_h) $(arch_utils_h) \ $(symtab_h) $(dis_asm_h) $(trad_frame_h) $(frame_unwind_h) \ @@ -2194,13 +2196,13 @@ linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \ $(linux_nat_h) linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_string_h) \ $(gdb_wait_h) $(gdb_assert_h) $(linux_nat_h) $(gdbthread_h) \ - $(gdbcmd_h) $(regcache_h) $(inf_ptrace.h) $(auxv.h) $(elf_bfd_h) \ + $(gdbcmd_h) $(regcache_h) $(inf_ptrace_h) $(auxv_h) $(elf_bfd_h) \ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_h) \ $(linux_fork_h) linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \ $(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \ $(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \ - $(regcache_h) $(solib_svr4_h) $(gdbcore_h) + $(regcache_h) $(solib_svr4_h) $(gdbcore_h) $(linux_nat_h) lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ $(gdbcore_h) $(regcache_h) m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \ @@ -2336,9 +2338,9 @@ mn10300-linux-tdep.o: mn10300-linux-tdep.c $(defs_h) $(gdbcore_h) \ $(frame_h) $(trad_frame_h) $(tramp_frame_h) mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) \ $(gdbtypes_h) $(regcache_h) $(gdb_string_h) $(gdb_assert_h) \ + $(gdbcore_h) $(value_h) $(gdbtypes_h) \ $(frame_h) $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) \ $(symtab_h) $(dwarf2_frame_h) $(osabi_h) $(mn10300_tdep_h) - monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(exceptions_h) \ $(gdb_string_h) $(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) \ $(inferior_h) $(gdb_regex_h) $(srec_h) $(regcache_h) @@ -2369,7 +2371,7 @@ objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(mdebugread_h) \ $(gdb_assert_h) $(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) \ - $(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h) + $(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h) $(source_h) observer.o: observer.c $(defs_h) $(observer_h) $(command_h) $(gdbcmd_h) \ $(observer_inc) obsd-tdep.o: obsd-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(obsd_tdep_h) @@ -2380,8 +2382,8 @@ osabi.o: osabi.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(osabi_h) \ $(arch_utils_h) $(gdbcmd_h) $(command_h) $(elf_bfd_h) parse.o: parse.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(frame_h) $(expression_h) $(value_h) $(command_h) $(language_h) \ - $(parser_defs_h) $(gdbcmd_h) $(symfile_h) $(inferior_h) \ - $(doublest_h) $(gdb_assert_h) $(block_h) + $(f_lang_h) $(parser_defs_h) $(gdbcmd_h) $(symfile_h) $(inferior_h) \ + $(doublest_h) $(gdb_assert_h) $(block_h) $(source_h) p-exp.o: p-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \ $(parser_defs_h) $(language_h) $(p_lang_h) $(bfd_h) $(symfile_h) \ $(objfiles_h) $(block_h) @@ -2416,8 +2418,8 @@ ppcobsd-nat.o: ppcobsd-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(bsd_kvm_h) ppcobsd-tdep.o: ppcobsd-tdep.c $(defs_h) $(arch_utils_h) $(floatformat_h) \ $(frame_h) $(frame_unwind_h) $(osabi_h) $(regcache_h) $(regset_h) \ - $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) $(ppc_tdep_h) \ - $(ppcobsd_tdep_h) $(solib_svr4_h) + $(symtab_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \ + $(ppc_tdep_h) $(ppcobsd_tdep_h) $(solib_svr4_h) ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \ $(ppc_tdep_h) $(target_h) $(objfiles_h) $(infcall_h) @@ -2433,7 +2435,7 @@ proc-flags.o: proc-flags.c $(defs_h) procfs.o: procfs.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \ $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) $(gdb_wait_h) \ $(gdb_string_h) $(gdb_assert_h) $(inflow_h) $(auxv_h) \ - $(gdb_dirent_h) $(X_OK) $(gdb_stat_h) $(proc_utils_h) $(gregset_h) + $(gdb_dirent_h) $(gdb_stat_h) $(proc_utils_h) $(gregset_h) proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \ $(symtab_h) $(target_h) $(gregset_h) proc-why.o: proc-why.c $(defs_h) $(proc_utils_h) @@ -2514,7 +2516,8 @@ s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ $(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \ $(floatformat_h) $(regcache_h) $(trad_frame_h) $(frame_base_h) \ $(frame_unwind_h) $(dwarf2_frame_h) $(reggroups_h) $(regset_h) \ - $(value_h) $(gdb_assert_h) $(dis_asm_h) $(solib_svr4_h) $(s390_tdep_h) + $(value_h) $(gdb_assert_h) $(dis_asm_h) $(solib_svr4_h) \ + $(prologue_value_h) $(s390_tdep_h) scm-exp.o: scm-exp.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(value_h) $(c_lang_h) $(scm_lang_h) \ $(scm_tags_h) @@ -2560,7 +2563,7 @@ sh-tdep.o: sh-tdep.c $(defs_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(gdb_assert_h) $(arch_utils_h) $(floatformat_h) $(regcache_h) \ $(doublest_h) $(osabi_h) $(sh_tdep_h) $(elf_bfd_h) $(solib_svr4_h) \ $(elf_sh_h) $(gdb_sim_sh_h) $(reggroups_h) -sol2-tdep.o: sol2-tdep.c $(defs_h) $(frame_h) $(symtab_h) +sol2-tdep.o: sol2-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(sol2_tdep_h) solib-aix5.o: solib-aix5.c $(defs_h) $(gdb_string_h) $(elf_external_h) \ $(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(gdbcore_h) \ $(command_h) $(target_h) $(frame_h) $(gdb_regex_h) $(inferior_h) \ @@ -2611,11 +2614,13 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $(defs_h) $(frame_h) \ $(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \ $(target_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \ $(sparc64_tdep_h) $(solib_svr4_h) -sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \ +sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(regcache_h) \ + $(gregset_h) $(sparc64_tdep_h) $(sparc_tdep_h) \ $(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h) sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \ - $(frame_unwind_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \ - $(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h) + $(frame_unwind_h) $(dwarf2-frame_h) $(regset_h) $(regcache_h) \ + $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(solib_svr4_h) $(symtab_h) \ + $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h) sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \ $(sparc_nat_h) sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \ @@ -2630,18 +2635,20 @@ sparc64obsd-tdep.o: sparc64obsd-tdep.c $(defs_h) $(frame_h) \ $(obsd_tdep_h) $(sparc64_tdep_h) $(solib_svr4_h) $(bsd_uthread_h) sparc64-sol2-tdep.o: sparc64-sol2-tdep.c $(defs_h) $(frame_h) \ $(frame_unwind_h) $(gdbarch_h) $(symtab_h) $(objfiles_h) $(osabi_h) \ - $(trad_frame_h) $(gdb_assert_h) $(sparc64_tdep_h) $(solib_svr4_h) + $(trad_frame_h) $(gdb_assert_h) $(sol2_tdep_h) $(sparc64_tdep_h) \ + $(solib_svr4_h) sparc64-tdep.o: sparc64-tdep.c $(defs_h) $(arch_utils_h) $(dwarf2_frame_h) \ $(floatformat_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(gdbcore_h) $(gdbtypes_h) $(inferior_h) $(symtab_h) $(objfiles_h) \ $(osabi_h) $(regcache_h) $(target_h) $(value_h) $(gdb_assert_h) \ $(gdb_string_h) $(sparc64_tdep_h) -sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(inferior_h) $(target_h) \ +sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(gregset_h) \ + $(sparc_tdep_h) $(sparc_nat_h) $(inferior_h) $(target_h) \ $(linux_nat_h) -sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \ - $(frame_unwind_h) $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) \ - $(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(tramp_frame_h) \ - $(sparc_tdep_h) +sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(dwarf2_frame_h) \ + $(floatformat_h) $(frame_h) $(frame_unwind_h) $(regset_h) \ + $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(solib_svr4_h) \ + $(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc_tdep_h) sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \ $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) \ $(sparc_nat_h) $(inf_ptrace_h) @@ -2660,13 +2667,13 @@ sparc-sol2-nat.o: sparc-sol2-nat.c $(defs_h) $(regcache_h) $(gregset_h) \ sparc-sol2-tdep.o: sparc-sol2-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) \ $(gdbcore_h) $(symtab_h) $(objfiles_h) $(osabi_h) $(regcache_h) \ $(target_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \ - $(sparc_tdep_h) $(solib_svr4_h) + $(sol2_tdep_h) $(sparc_tdep_h) $(solib_svr4_h) sparc-stub.o: sparc-stub.c sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) \ - $(floatformat_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ - $(gdbcore_h) $(gdbtypes_h) $(inferior_h) $(symtab_h) $(objfiles_h) \ - $(osabi_h) $(regcache_h) $(target_h) $(value_h) $(gdb_assert_h) \ - $(gdb_string_h) $(sparc_tdep_h) + $(dwarf2_frame_h) $(floatformat_h) $(frame_h) $(frame_base_h) \ + $(frame_unwind_h) $(gdbcore_h) $(gdbtypes_h) $(inferior_h) \ + $(symtab_h) $(objfiles_h) $(osabi_h) $(regcache_h) $(target_h) \ + $(value_h) $(gdb_assert_h) $(gdb_string_h) $(sparc_tdep_h) stabsread.o: stabsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(gdb_obstack_h) \ $(symtab_h) $(gdbtypes_h) $(expression_h) $(symfile_h) $(objfiles_h) \ $(aout_stab_gnu_h) $(libaout_h) $(aout_aout64_h) $(gdb_stabs_h) \ @@ -2677,7 +2684,7 @@ stack.o: stack.c $(defs_h) $(value_h) $(symtab_h) $(gdbtypes_h) \ $(target_h) $(source_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \ $(annotate_h) $(ui_out_h) $(block_h) $(stack_h) $(dictionary_h) \ $(exceptions_h) $(reggroups_h) $(regcache_h) $(solib_h) \ - $(valprint.h)$(gdb_assert_h) $(gdb_string_h) + $(valprint_h) $(gdb_assert_h) $(gdb_string_h) std-regs.o: std-regs.c $(defs_h) $(user_regs_h) $(frame_h) $(gdbtypes_h) \ $(value_h) $(gdb_string_h) stop-gdb.o: stop-gdb.c $(defs_h) @@ -2694,8 +2701,8 @@ symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \ symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \ $(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \ $(gdb_obstack_h) $(exceptions_h) $(language_h) $(bcache_h) \ - $(block_h) $(gdb_regex_h) $(dictionary_h) $(gdb_string_h) \ - $(readline_h) + $(block_h) $(gdb_regex_h) $(gdb_stat_h) $(dictionary_h) \ + $(gdb_string_h) $(readline_h) symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \ $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \ $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \ @@ -2764,26 +2771,27 @@ value.o: value.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcore_h) $(command_h) $(gdbcmd_h) $(target_h) \ $(language_h) $(scm_lang_h) $(demangle_h) $(doublest_h) \ $(gdb_assert_h) $(regcache_h) $(block_h) -varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \ - $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h) +varobj.o: varobj.c $(defs_h) $(exceptions_h) $(value_h) $(expression_h) \ + $(frame_h) $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_assert_h) \ + $(gdb_string_h) $(varobj_h) vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \ $(vax_tdep_h) $(inf_ptrace_h) $(bsd_kvm_h) vax-nat.o: vax-nat.c $(defs_h) $(inferior_h) $(gdb_assert_h) $(vax_tdep_h) \ $(inf_ptrace_h) vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \ $(vax_tdep_h) $(solib_svr4_h) $(gdb_string_h) -vaxobsd-tdep.o: vaxobsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ +vaxobsd-tdep.o: vaxobsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ $(frame_unwind_h) $(osabi_h) $(symtab_h) $(trad_frame_h) \ $(vax_tdep_h) $(gdb_string_h) vax-tdep.o: vax-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) \ - $(float_format_h)$(frame_h) $(frame_base_h) $(frame_unwind_h) \ + $(float_format_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \ $(gdbcore_h) $(gdbtypes_h) $(osabi_h) $(regcache_h) $(regset_h) \ $(trad_frame_h) $(value_h) $(gdb_string_h) $(vax_tdep_h) win32-nat.o: win32-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ $(exceptions_h) $(gdbcore_h) $(command_h) $(completer_h) \ $(regcache_h) $(top_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \ - $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(exec_h) $(i386_tdep_h) \ - $(i387_tdep_h) + $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(exec_h) $(solist_h) \ + $(solib_h) $(i386_tdep_h) $(i387_tdep_h) wince.o: wince.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ $(exceptions_h) $(gdbcore_h) $(command_h) $(buildsym_h) $(symfile_h) \ $(objfiles_h) $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) \ @@ -2819,8 +2827,8 @@ cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(defs_h) $(readline_h) \ $(tui_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) \ - $(gdb_regex_h) $(gdb_string_h) $(ui_out_h) $(cli_cmds_h) \ - $(cli_decode_h) $(tui_h) $(gdb_assert_h) + $(gdb_regex_h) $(gdb_string_h) $(completer_h) $(ui_out_h) \ + $(cli_cmds_h) $(cli_decode_h) $(tui_h) $(gdb_assert_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-decode.c cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) \ $(cli_decode_h) $(cli_cmds_h) $(value_h) $(completer_h) \ @@ -3050,7 +3058,7 @@ mi-parse.o: $(srcdir)/mi/mi-parse.c $(defs_h) $(mi_cmds_h) $(mi_parse_h) \ mi-symbol-cmds.o: $(srcdir)/mi/mi-symbol-cmds.c $(defs_h) $(mi_cmds_h) \ $(symtab_h) $(ui_out_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-symbol-cmds.c -mi-common.o: $(srcdir)/mi/mi-common.c $(mi_common_h) +mi-common.o: $(srcdir)/mi/mi-common.c $(defs_h) $(mi_common_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-common.c # @@ -3099,7 +3107,8 @@ tui-hooks.o: $(srcdir)/tui/tui-hooks.c $(defs_h) $(symtab_h) $(inferior_h) \ $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-hooks.c tui-interp.o: $(srcdir)/tui/tui-interp.c $(defs_h) $(interps_h) $(top_h) \ $(event_top_h) $(event_loop_h) $(ui_out_h) $(cli_out_h) \ - $(tui_data_h) $(readline_h) $(tui_win_h) $(tui_h) $(tui_io_h) + $(tui_data_h) $(readline_h) $(tui_win_h) $(tui_h) $(tui_io_h) \ + $(exceptions_h) $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-interp.c tui-io.o: $(srcdir)/tui/tui-io.c $(defs_h) $(target_h) \ $(event_loop_h) $(event_top_h) $(command_h) $(top_h) $(tui_h) \ diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 960b051..4480b21 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1493,8 +1493,6 @@ void alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p) { static CORE_ADDR next_pc; - typedef char binsn_quantum[BREAKPOINT_MAX]; - static binsn_quantum break_mem; CORE_ADDR pc; if (insert_breakpoints_p) @@ -1502,11 +1500,11 @@ alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p) pc = read_pc (); next_pc = alpha_next_pc (pc); - target_insert_breakpoint (next_pc, break_mem); + insert_single_step_breakpoint (next_pc); } else { - target_remove_breakpoint (next_pc, break_mem); + remove_single_step_breakpoints (); write_pc (next_pc); } } diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index b8c0d25..cefda62 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -79,8 +79,8 @@ static const char arm_linux_thumb_le_breakpoint[] = {0x01, 0xde}; hidden behind the regcache abstraction. */ static void arm_linux_extract_return_value (struct type *type, - char regbuf[], - char *valbuf) + gdb_byte regbuf[], + gdb_byte *valbuf) { /* ScottB: This needs to be looked at to handle the different floating point emulators on ARM GNU/Linux. Right now the code diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index cb3c261..a5da56c 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -466,9 +466,9 @@ thumb_scan_prologue (CORE_ADDR prev_pc, struct arm_prologue_cache *cache) prologue_end = sal.end; /* (probably means no prologue) */ } else - /* We're in the boondocks: allow for - 16 pushes, an add, and "mv fp,sp". */ - prologue_end = prologue_start + 40; + /* We're in the boondocks: we have no idea where the start of the + function is. */ + return; prologue_end = min (prologue_end, prev_pc); @@ -1849,16 +1849,18 @@ arm_get_next_pc (CORE_ADDR pc) static void arm_software_single_step (enum target_signal sig, int insert_bpt) { - static int next_pc; /* State between setting and unsetting. */ - static char break_mem[BREAKPOINT_MAX]; /* Temporary storage for mem@bpt */ + /* NOTE: This may insert the wrong breakpoint instruction when + single-stepping over a mode-changing instruction, if the + CPSR heuristics are used. */ if (insert_bpt) { - next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM)); - target_insert_breakpoint (next_pc, break_mem); + CORE_ADDR next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM)); + + insert_single_step_breakpoint (next_pc); } else - target_remove_breakpoint (next_pc, break_mem); + remove_single_step_breakpoints (); } #include "bfd-in2.h" diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 31b3b4b..130b684 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -663,16 +663,10 @@ deprecated_read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr, continue; /* Addresses and length of the part of the breakpoint that we need to copy. */ - /* XXXX The m68k, sh and h8300 have different local and remote - breakpoint values. BREAKPOINT_FROM_PC still manages to - correctly determine the breakpoints memory address and size - for these targets. */ - bp_addr = b->address; - bp_size = 0; - if (BREAKPOINT_FROM_PC (&bp_addr, &bp_size) == NULL) - continue; + bp_addr = b->target_info.placed_address; + bp_size = b->target_info.shadow_len; if (bp_size == 0) - /* bp isn't valid */ + /* bp isn't valid, or doesn't shadow memory. */ continue; if (bp_addr + bp_size <= memaddr) /* The breakpoint is entirely before the chunk of memory we @@ -703,7 +697,7 @@ deprecated_read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr, } memcpy (myaddr + bp_addr - memaddr, - b->shadow_contents + bptoffset, bp_size); + b->target_info.shadow_contents + bptoffset, bp_size); if (bp_addr > memaddr) { @@ -793,6 +787,10 @@ insert_bp_location (struct bp_location *bpt, if (bpt->inserted || bpt->duplicate) return 0; + /* Initialize the target-specific information. */ + memset (&bpt->target_info, 0, sizeof (bpt->target_info)); + bpt->target_info.placed_address = bpt->address; + if (bpt->loc_type == bp_loc_software_breakpoint || bpt->loc_type == bp_loc_hardware_breakpoint) { @@ -804,11 +802,9 @@ insert_bp_location (struct bp_location *bpt, /* No overlay handling: just set the breakpoint. */ if (bpt->loc_type == bp_loc_hardware_breakpoint) - val = target_insert_hw_breakpoint (bpt->address, - bpt->shadow_contents); + val = target_insert_hw_breakpoint (&bpt->target_info); else - val = target_insert_breakpoint (bpt->address, - bpt->shadow_contents); + val = target_insert_breakpoint (&bpt->target_info); } else { @@ -827,7 +823,9 @@ insert_bp_location (struct bp_location *bpt, CORE_ADDR addr = overlay_unmapped_address (bpt->address, bpt->section); /* Set a software (trap) breakpoint at the LMA. */ - val = target_insert_breakpoint (addr, bpt->shadow_contents); + bpt->overlay_target_info = bpt->target_info; + bpt->overlay_target_info.placed_address = addr; + val = target_insert_breakpoint (&bpt->overlay_target_info); if (val != 0) fprintf_unfiltered (tmp_error_stream, "Overlay breakpoint %d failed: in ROM?", @@ -839,11 +837,9 @@ insert_bp_location (struct bp_location *bpt, { /* Yes. This overlay section is mapped into memory. */ if (bpt->loc_type == bp_loc_hardware_breakpoint) - val = target_insert_hw_breakpoint (bpt->address, - bpt->shadow_contents); + val = target_insert_hw_breakpoint (&bpt->target_info); else - val = target_insert_breakpoint (bpt->address, - bpt->shadow_contents); + val = target_insert_breakpoint (&bpt->target_info); } else { @@ -1045,7 +1041,7 @@ in which its expression is valid.\n"), /* If we get here, we must have a callback mechanism for exception events -- with g++ style embedded label support, we insert ordinary breakpoints and not catchpoints. */ - val = target_insert_breakpoint (bpt->address, bpt->shadow_contents); + val = target_insert_breakpoint (&bpt->target_info); if (val) { /* Couldn't set breakpoint for some reason */ @@ -1240,9 +1236,9 @@ reattach_breakpoints (int pid) { remove_breakpoint (b, mark_inserted); if (b->loc_type == bp_loc_hardware_breakpoint) - val = target_insert_hw_breakpoint (b->address, b->shadow_contents); + val = target_insert_hw_breakpoint (&b->target_info); else - val = target_insert_breakpoint (b->address, b->shadow_contents); + val = target_insert_breakpoint (&b->target_info); /* FIXME drow/2003-10-07: This doesn't handle any other kinds of breakpoints. It's wrong for watchpoints, for example. */ if (val != 0) @@ -1446,10 +1442,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) /* No overlay handling: just remove the breakpoint. */ if (b->loc_type == bp_loc_hardware_breakpoint) - val = target_remove_hw_breakpoint (b->address, - b->shadow_contents); + val = target_remove_hw_breakpoint (&b->target_info); else - val = target_remove_breakpoint (b->address, b->shadow_contents); + val = target_remove_breakpoint (&b->target_info); } else { @@ -1460,14 +1455,12 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) /* Yes -- overlay event support is not active, so we should have set a breakpoint at the LMA. Remove it. */ - CORE_ADDR addr = overlay_unmapped_address (b->address, - b->section); /* Ignore any failures: if the LMA is in ROM, we will have already warned when we failed to insert it. */ if (b->loc_type == bp_loc_hardware_breakpoint) - target_remove_hw_breakpoint (addr, b->shadow_contents); + target_remove_hw_breakpoint (&b->overlay_target_info); else - target_remove_breakpoint (addr, b->shadow_contents); + target_remove_breakpoint (&b->overlay_target_info); } /* Did we set a breakpoint at the VMA? If so, we will have marked the breakpoint 'inserted'. */ @@ -1478,11 +1471,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) unmapped, but let's not rely on that being safe. We don't know what the overlay manager might do. */ if (b->loc_type == bp_loc_hardware_breakpoint) - val = target_remove_hw_breakpoint (b->address, - b->shadow_contents); + val = target_remove_hw_breakpoint (&b->target_info); else - val = target_remove_breakpoint (b->address, - b->shadow_contents); + val = target_remove_breakpoint (&b->target_info); } else { @@ -1570,8 +1561,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) && breakpoint_enabled (b->owner) && !b->duplicate) { - - val = target_remove_breakpoint (b->address, b->shadow_contents); + val = target_remove_breakpoint (&b->target_info); if (val) return val; b->inserted = (is == mark_inserted); @@ -1581,8 +1571,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) && breakpoint_enabled (b->owner) && !b->duplicate) { - - val = target_remove_breakpoint (b->address, b->shadow_contents); + val = target_remove_breakpoint (&b->target_info); if (val) return val; @@ -6852,10 +6841,12 @@ delete_breakpoint (struct breakpoint *bpt) _("another breakpoint was inserted on top of " "a permanent breakpoint")); + memset (&b->loc->target_info, 0, sizeof (b->loc->target_info)); + b->loc->target_info.placed_address = b->loc->address; if (b->type == bp_hardware_breakpoint) - val = target_insert_hw_breakpoint (b->loc->address, b->loc->shadow_contents); + val = target_insert_hw_breakpoint (&b->loc->target_info); else - val = target_insert_breakpoint (b->loc->address, b->loc->shadow_contents); + val = target_insert_breakpoint (&b->loc->target_info); /* If there was an error in the insert, print a message, then stop execution. */ if (val != 0) @@ -7658,6 +7649,97 @@ decode_line_spec_1 (char *string, int funfirstline) error (_("Junk at end of line specification: %s"), string); return sals; } + +/* Create and insert a raw software breakpoint at PC. Return an + identifier, which should be used to remove the breakpoint later. + In general, places which call this should be using something on the + breakpoint chain instead; this function should be eliminated + someday. */ + +void * +deprecated_insert_raw_breakpoint (CORE_ADDR pc) +{ + struct bp_target_info *bp_tgt; + + bp_tgt = xmalloc (sizeof (struct bp_target_info)); + memset (bp_tgt, 0, sizeof (struct bp_target_info)); + + bp_tgt->placed_address = pc; + if (target_insert_breakpoint (bp_tgt) != 0) + { + /* Could not insert the breakpoint. */ + xfree (bp_tgt); + return NULL; + } + + return bp_tgt; +} + +/* Remove a breakpoint BP inserted by deprecated_insert_raw_breakpoint. */ + +int +deprecated_remove_raw_breakpoint (void *bp) +{ + struct bp_target_info *bp_tgt = bp; + int ret; + + ret = target_remove_breakpoint (bp_tgt); + xfree (bp_tgt); + + return ret; +} + +/* One (or perhaps two) breakpoints used for software single stepping. */ + +static void *single_step_breakpoints[2]; + +/* Create and insert a breakpoint for software single step. */ + +void +insert_single_step_breakpoint (CORE_ADDR next_pc) +{ + void **bpt_p; + + if (single_step_breakpoints[0] == NULL) + bpt_p = &single_step_breakpoints[0]; + else + { + gdb_assert (single_step_breakpoints[1] == NULL); + bpt_p = &single_step_breakpoints[1]; + } + + /* NOTE drow/2006-04-11: A future improvement to this function would be + to only create the breakpoints once, and actually put them on the + breakpoint chain. That would let us use set_raw_breakpoint. We could + adjust the addresses each time they were needed. Doing this requires + corresponding changes elsewhere where single step breakpoints are + handled, however. So, for now, we use this. */ + + *bpt_p = deprecated_insert_raw_breakpoint (next_pc); + if (*bpt_p == NULL) + warning (_("Could not insert single-step breakpoint at 0x%s"), + paddr_nz (next_pc)); +} + +/* Remove and delete any breakpoints used for software single step. */ + +void +remove_single_step_breakpoints (void) +{ + gdb_assert (single_step_breakpoints[0] != NULL); + + /* See insert_single_step_breakpoint for more about this deprecated + call. */ + deprecated_remove_raw_breakpoint (single_step_breakpoints[0]); + single_step_breakpoints[0] = NULL; + + if (single_step_breakpoints[1] != NULL) + { + deprecated_remove_raw_breakpoint (single_step_breakpoints[1]); + single_step_breakpoints[1] = NULL; + } +} + /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. @@ -7813,6 +7895,7 @@ Also a prefix command for deletion of other GDB objects.\n\ The \"unset\" command is also an alias for \"delete\"."), &deletelist, "delete ", 1, &cmdlist); add_com_alias ("d", "delete", class_breakpoint, 1); + add_com_alias ("del", "delete", class_breakpoint, 1); if (xdb_commands) add_com ("db", class_breakpoint, delete_command, _("\ Delete some breakpoints.\n\ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index d1e2fd8..607fd77 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -185,6 +185,36 @@ enum target_hw_bp_type hw_execute = 3 /* Execute HW breakpoint */ }; + +/* Information used by targets to insert and remove breakpoints. */ + +struct bp_target_info +{ + /* Address at which the breakpoint was placed. This is normally the + same as ADDRESS from the bp_location, except when adjustment + happens in BREAKPOINT_FROM_PC. The most common form of + adjustment is stripping an alternate ISA marker from the PC which + is used to determine the type of breakpoint to insert. */ + CORE_ADDR placed_address; + + /* If the breakpoint lives in memory and reading that memory would + give back the breakpoint, instead of the original contents, then + the original contents are cached here. Only SHADOW_LEN bytes of + this buffer are valid, and only when the breakpoint is inserted. */ + gdb_byte shadow_contents[BREAKPOINT_MAX]; + + /* The length of the data cached in SHADOW_CONTENTS. */ + int shadow_len; + + /* The size of the placed breakpoint, according to + BREAKPOINT_FROM_PC, when the breakpoint was inserted. This is + generally the same as SHADOW_LEN, unless we did not need + to read from the target to implement the memory breakpoint + (e.g. if a remote stub handled the details). We may still + need the size to remove the breakpoint safely. */ + int placed_size; +}; + /* GDB maintains two types of information about each breakpoint (or watchpoint, or other related event). The first type corresponds to struct breakpoint; this is a relatively high-level structure @@ -242,13 +272,6 @@ struct bp_location associated with the address. Used primarily for overlay debugging. */ asection *section; - /* "Real" contents of byte where breakpoint has been inserted. - Valid only when breakpoints are in the program. Under the complete - control of the target insert_breakpoint and remove_breakpoint routines. - No other code should assume anything about the value(s) here. - Valid only for bp_loc_software_breakpoint. */ - gdb_byte shadow_contents[BREAKPOINT_MAX]; - /* Address at which breakpoint was requested, either by the user or by GDB for internal breakpoints. This will usually be the same as ``address'' (above) except for cases in which @@ -256,6 +279,12 @@ struct bp_location which to place the breakpoint in order to comply with a processor's architectual constraints. */ CORE_ADDR requested_address; + + /* Details of the placed breakpoint, when inserted. */ + struct bp_target_info target_info; + + /* Similarly, for the breakpoint at an overlay's LMA, if necessary. */ + struct bp_target_info overlay_target_info; }; /* This structure is a collection of function pointers that, if available, @@ -796,6 +825,16 @@ extern void delete_command (char *arg, int from_tty); remove fails. */ extern int remove_hw_watchpoints (void); +/* Manage a software single step breakpoint (or two). Insert may be called + twice before remove is called. */ +extern void insert_single_step_breakpoint (CORE_ADDR); +extern void remove_single_step_breakpoints (void); + +/* Manage manual breakpoints, separate from the normal chain of + breakpoints. These functions are used in murky target-specific + ways. Please do not add more uses! */ +extern void *deprecated_insert_raw_breakpoint (CORE_ADDR); +extern int deprecated_remove_raw_breakpoint (void *); /* Indicator of whether exception catchpoints should be nuked between runs of a program. */ diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index b8e9d4f..4f44477 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -54,6 +54,9 @@ static int control_level; struct user_args { struct user_args *next; + /* It is necessary to store a malloced copy of the command line to + ensure that the arguments are not overwritten before they are used. */ + char *command; struct { char *arg; @@ -483,6 +486,7 @@ arg_cleanup (void *ignore) _("arg_cleanup called with no user args.\n")); user_args = user_args->next; + xfree (oargs->command); xfree (oargs); } @@ -507,6 +511,8 @@ setup_user_args (char *p) if (p == NULL) return old_chain; + user_args->command = p = xstrdup (p); + while (*p) { char *start_arg; @@ -593,6 +599,11 @@ insert_args (char *line) char *p, *save_line, *new_line; unsigned len, i; + /* If we are not in a user-defined function, treat $argc, $arg0, et + cetera as normal convenience variables. */ + if (user_args == NULL) + return xstrdup (line); + /* First we need to know how much memory to allocate for the new line. */ save_line = line; len = 0; diff --git a/gdb/config/i386/nm-i386.h b/gdb/config/i386/nm-i386.h index 265c8e0..26215eb 100644 --- a/gdb/config/i386/nm-i386.h +++ b/gdb/config/i386/nm-i386.h @@ -52,13 +52,14 @@ extern int i386_stopped_by_hwbp (void); true. Otherwise, return false. */ extern int i386_stopped_data_address (CORE_ADDR *); -/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is - unused. Return 0 on success, EBUSY on failure. */ -extern int i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow); +/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. + Return 0 on success, EBUSY on failure. */ +struct bp_target_info; +extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt); -/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is - unused. Return 0 on success, -1 on failure. */ -extern int i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow); +/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address. + Return 0 on success, -1 on failure. */ +extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt); /* Returns the number of hardware watchpoints of type TYPE that we can set. Value is positive if we can set CNT watchpoints, zero if @@ -105,11 +106,11 @@ extern int i386_stopped_by_watchpoint (void); #define target_remove_watchpoint(addr, len, type) \ i386_remove_watchpoint (addr, len, type) -#define target_insert_hw_breakpoint(addr, shadow) \ - i386_insert_hw_breakpoint (addr, shadow) +#define target_insert_hw_breakpoint(bp_tgt) \ + i386_insert_hw_breakpoint (bp_tgt) -#define target_remove_hw_breakpoint(addr, shadow) \ - i386_remove_hw_breakpoint (addr, shadow) +#define target_remove_hw_breakpoint(bp_tgt) \ + i386_remove_hw_breakpoint (bp_tgt) /* child_post_startup_inferior used to reset all debug registers by calling i386_cleanup_dregs (). */ diff --git a/gdb/config/pa/linux.mh b/gdb/config/pa/linux.mh index b0362e4..8066fff 100644 --- a/gdb/config/pa/linux.mh +++ b/gdb/config/pa/linux.mh @@ -2,7 +2,7 @@ XDEPFILES= NAT_FILE= nm-linux.h NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \ - core-regset.o hppa-linux-nat.o \ - proc-service.o linux-thread-db.o linux-nat.o linux-fork.o + hppa-linux-nat.o proc-service.o linux-thread-db.o linux-nat.o \ + linux-fork.o LOADLIBES = -ldl -rdynamic diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh index 0494381..b640a92 100644 --- a/gdb/config/sparc/linux.mh +++ b/gdb/config/sparc/linux.mh @@ -1,6 +1,6 @@ # Host: GNU/Linux SPARC NAT_FILE= nm-linux.h -NATDEPFILES= sparc-nat.o sparc-sol2-nat.o sparc-linux-nat.o \ +NATDEPFILES= sparc-nat.o sparc-linux-nat.o \ corelow.o core-regset.o fork-child.o inf-ptrace.o \ proc-service.o linux-thread-db.o \ gcore.o linux-nat.o linux-fork.o diff --git a/gdb/config/sparc/linux64.mh b/gdb/config/sparc/linux64.mh index 59dfbf0..195940c 100644 --- a/gdb/config/sparc/linux64.mh +++ b/gdb/config/sparc/linux64.mh @@ -1,6 +1,6 @@ # Host: GNU/Linux UltraSPARC NAT_FILE= nm-linux.h -NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \ +NATDEPFILES= sparc-nat.o sparc64-nat.o sparc64-linux-nat.o \ corelow.o core-regset.o \ fork-child.o inf-ptrace.o \ proc-service.o linux-thread-db.o \ diff --git a/gdb/corelow.c b/gdb/corelow.c index 226b48b..fa61bf3 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -86,8 +86,6 @@ static void get_core_registers (int); static void add_to_thread_list (bfd *, asection *, void *); -static int ignore (CORE_ADDR, bfd_byte *); - static int core_file_thread_alive (ptid_t tid); static void init_core_ops (void); @@ -603,7 +601,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object, `gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */ static int -ignore (CORE_ADDR addr, bfd_byte *contents) +ignore (struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 0664318..4e1540e 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -558,15 +558,6 @@ struct instruction_environment int disable_interrupt; } inst_env_type; -/* Save old breakpoints in order to restore the state before a single_step. - At most, two breakpoints will have to be remembered. */ -typedef -char binsn_quantum[BREAKPOINT_MAX]; -static binsn_quantum break_mem[2]; -static CORE_ADDR next_pc = 0; -static CORE_ADDR branch_target_address = 0; -static unsigned char branch_break_inserted = 0; - /* Machine-dependencies in CRIS for opcodes. */ /* Instruction sizes. */ @@ -1852,7 +1843,8 @@ cris_dwarf2_reg_to_regnum (int reg) static void cris_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, - struct dwarf2_frame_state_reg *reg) + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) { /* The return address column. */ if (regnum == PC_REGNUM) @@ -2129,7 +2121,7 @@ static void cris_software_single_step (enum target_signal ignore, int insert_breakpoints) { inst_env_type inst_env; - + if (insert_breakpoints) { /* Analyse the present instruction environment and insert @@ -2145,28 +2137,19 @@ cris_software_single_step (enum target_signal ignore, int insert_breakpoints) { /* Insert at most two breakpoints. One for the next PC content and possibly another one for a branch, jump, etc. */ - next_pc = (CORE_ADDR) inst_env.reg[PC_REGNUM]; - target_insert_breakpoint (next_pc, break_mem[0]); + CORE_ADDR next_pc = (CORE_ADDR) inst_env.reg[PC_REGNUM]; + insert_single_step_breakpoint (next_pc); if (inst_env.branch_found && (CORE_ADDR) inst_env.branch_break_address != next_pc) { - branch_target_address = - (CORE_ADDR) inst_env.branch_break_address; - target_insert_breakpoint (branch_target_address, break_mem[1]); - branch_break_inserted = 1; + CORE_ADDR branch_target_address + = (CORE_ADDR) inst_env.branch_break_address; + insert_single_step_breakpoint (branch_target_address); } } } else - { - /* Remove breakpoints. */ - target_remove_breakpoint (next_pc, break_mem[0]); - if (branch_break_inserted) - { - target_remove_breakpoint (branch_target_address, break_mem[1]); - branch_break_inserted = 0; - } - } + remove_single_step_breakpoints (); } /* Calculates the prefix value for quick offset addressing mode. */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 40c8020..66ff9d7 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,23 @@ +2006-04-18 Daniel Jacobowitz + + * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert + and remove breakpoint prototypes. + (Watchpoints): Move description of target_insert_hw_breakpoint and + target_remove_hw_breakpoint ... + (Breakpoints): ... to here. Document target_insert_breakpoint and + target_remove_breakpoint. + +2006-04-17 Jim Blandy + + * gdb.texinfo (Packets): Note that 'addr' arguments to s, S, c, + and C packets are optional. + +2006-04-14 Frederic Riss + + * gdb.texinfo (Specifying source directories): Update the description + of the source file search to reflect the fact that the source path + always contains at least $cdir and $cwd. + 2006-03-31 Michael Snyder * gdb.texinfo: Update copyright dates. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 59445d0..790c58d 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -5005,8 +5005,7 @@ is recorded as @file{../lib/foo.c}, @value{GDBN} would first try that---@file{/mnt/cross/foo.c}. Note that the executable search path is @emph{not} used to locate the -source files. Neither is the current working directory, unless it -happens to be in the source path. +source files. Whenever you reset or rearrange the source path, @value{GDBN} clears out any information it has cached about where source files are found and where @@ -5048,7 +5047,7 @@ session, while the latter is immediately expanded to the current directory at the time you add an entry to the source path. @item directory -Reset the source path to empty again. This requires confirmation. +Reset the source path to its default value (@samp{$cdir:$cwd} on Unix systems). This requires confirmation. @c RET-repeat for @code{directory} is explicitly disabled, but since @c repeating it would be a no-op we do not say that. (thanks to RMS) @@ -5064,7 +5063,7 @@ versions of source. You can correct the situation as follows: @enumerate @item -Use @code{directory} with no argument to reset the source path to empty. +Use @code{directory} with no argument to reset the source path to its default value. @item Use @code{directory} with suitable arguments to reinstall the @@ -22555,7 +22554,7 @@ breakpoint at @var{addr}. Don't use this packet. Use the @samp{Z} and @samp{z} packets instead (@pxref{insert breakpoint or watchpoint packet}). -@item c @var{addr} +@item c @r{[}@var{addr}@r{]} @cindex @samp{c} packet Continue. @var{addr} is address to resume. If @var{addr} is omitted, resume at current address. @@ -22563,7 +22562,7 @@ resume at current address. Reply: @xref{Stop Reply Packets}, for the reply specifications. -@item C @var{sig};@var{addr} +@item C @var{sig}@r{[};@var{addr}@r{]} @cindex @samp{C} packet Continue with signal @var{sig} (hex signal number). If @samp{;@var{addr}} is omitted, resume at same address. @@ -22769,7 +22768,7 @@ This packet is only available in extended mode. The @samp{R} packet has no reply. -@item s @var{addr} +@item s @r{[}@var{addr}@r{]} @cindex @samp{s} packet Single step. @var{addr} is the address at which to resume. If @var{addr} is omitted, resume at same address. @@ -22777,7 +22776,7 @@ Single step. @var{addr} is the address at which to resume. If Reply: @xref{Stop Reply Packets}, for the reply specifications. -@item S @var{sig};@var{addr} +@item S @var{sig}@r{[};@var{addr}@r{]} @anchor{step with signal packet} @cindex @samp{S} packet Step with signal. This is analogous to the @samp{C} packet, but diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index e14aa2c..e1d1557 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -527,6 +527,47 @@ The basic definition of the software breakpoint is the macro Basic breakpoint object handling is in @file{breakpoint.c}. However, much of the interesting breakpoint action is in @file{infrun.c}. +@table @code +@cindex insert or remove software breakpoint +@findex target_remove_breakpoint +@findex target_insert_breakpoint +@item target_remove_breakpoint (@var{bp_tgt}) +@itemx target_insert_breakpoint (@var{bp_tgt}) +Insert or remove a software breakpoint at address +@code{@var{bp_tgt}->placed_address}. Returns zero for success, +non-zero for failure. On input, @var{bp_tgt} contains the address of the +breakpoint, and is otherwise initialized to zero. The fields of the +@code{struct bp_target_info} pointed to by @var{bp_tgt} are updated +to contain other information about the breakpoint on output. The field +@code{placed_address} may be updated if the breakpoint was placed at a +related address; the field @code{shadow_contents} contains the real +contents of the bytes where the breakpoint has been inserted, +if reading memory would return the breakpoint instead of the +underlying memory; the field @code{shadow_len} is the length of +memory cached in @code{shadow_contents}, if any; and the field +@code{placed_size} is optionally set and used by the target, if +it could differ from @code{shadow_len}. + +For example, the remote target @samp{Z0} packet does not require +shadowing memory, so @code{shadow_len} is left at zero. However, +the length reported by @code{BREAKPOINT_FROM_PC} is cached in +@code{placed_size}, so that a matching @samp{z0} packet can be +used to remove the breakpoint. + +@cindex insert or remove hardware breakpoint +@findex target_remove_hw_breakpoint +@findex target_insert_hw_breakpoint +@item target_remove_hw_breakpoint (@var{bp_tgt}) +@itemx target_insert_hw_breakpoint (@var{bp_tgt}) +Insert or remove a hardware-assisted breakpoint at address +@code{@var{bp_tgt}->placed_address}. Returns zero for success, +non-zero for failure. See @code{target_insert_breakpoint} for +a description of the @code{struct bp_target_info} pointed to by +@var{bp_tgt}; the @code{shadow_contents} and +@code{shadow_len} members are not used for hardware breakpoints, +but @code{placed_size} may be. +@end table + @section Single Stepping @section Signal Handling @@ -657,18 +698,6 @@ defined by @file{breakpoint.h} as follows: @noindent These two macros should return 0 for success, non-zero for failure. -@cindex insert or remove hardware breakpoint -@findex target_remove_hw_breakpoint -@findex target_insert_hw_breakpoint -@item target_remove_hw_breakpoint (@var{addr}, @var{shadow}) -@itemx target_insert_hw_breakpoint (@var{addr}, @var{shadow}) -Insert or remove a hardware-assisted breakpoint at address @var{addr}. -Returns zero for success, non-zero for failure. @var{shadow} is the -real contents of the byte where the breakpoint has been inserted; it -is generally not valid when hardware breakpoints are used, but since -no other code touches these values, the implementations of the above -two macros can use them for their internal purposes. - @findex target_stopped_data_address @item target_stopped_data_address (@var{addr_p}) If the inferior has some watchpoint that triggered, place the address @@ -858,11 +887,13 @@ the count goes to zero. @findex i386_insert_hw_breakpoint @findex i386_remove_hw_breakpoint -@item i386_insert_hw_breakpoint (@var{addr}, @var{shadow} -@itemx i386_remove_hw_breakpoint (@var{addr}, @var{shadow}) +@item i386_insert_hw_breakpoint (@var{bp_tgt}) +@itemx i386_remove_hw_breakpoint (@var{bp_tgt}) These functions insert and remove hardware-assisted breakpoints. The macros @code{target_insert_hw_breakpoint} and @code{target_remove_hw_breakpoint} are set to call these functions. +The argument is a @code{struct bp_target_info *}, as described in +the documentation for @code{target_insert_breakpoint}. These functions work like @code{i386_insert_watchpoint} and @code{i386_remove_watchpoint}, respectively, except that they set up the debug registers to watch instruction execution, and each @@ -3229,8 +3260,8 @@ instruction of the architecture. Replaces all the other @var{BREAKPOINT} macros. -@item MEMORY_INSERT_BREAKPOINT (@var{addr}, @var{contents_cache}) -@itemx MEMORY_REMOVE_BREAKPOINT (@var{addr}, @var{contents_cache}) +@item MEMORY_INSERT_BREAKPOINT (@var{bp_tgt}) +@itemx MEMORY_REMOVE_BREAKPOINT (@var{bp_tgt}) @findex MEMORY_REMOVE_BREAKPOINT @findex MEMORY_INSERT_BREAKPOINT Insert or remove memory based breakpoints. Reasonable defaults diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 668500d..d479da2 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -506,7 +506,8 @@ static struct gdbarch_data *dwarf2_frame_data; struct dwarf2_frame_ops { /* Pre-initialize the register state REG for register REGNUM. */ - void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *); + void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *, + struct frame_info *); /* Check whether the frame preceding NEXT_FRAME will be a signal trampoline. */ @@ -518,7 +519,8 @@ struct dwarf2_frame_ops static void dwarf2_frame_default_init_reg (struct gdbarch *gdbarch, int regnum, - struct dwarf2_frame_state_reg *reg) + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) { /* If we have a register that acts as a program counter, mark it as a destination for the return address. If we have a register that @@ -570,7 +572,8 @@ dwarf2_frame_init (struct obstack *obstack) void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, void (*init_reg) (struct gdbarch *, int, - struct dwarf2_frame_state_reg *)) + struct dwarf2_frame_state_reg *, + struct frame_info *)) { struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data); @@ -581,11 +584,12 @@ dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, static void dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, - struct dwarf2_frame_state_reg *reg) + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) { struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data); - ops->init_reg (gdbarch, regnum, reg); + ops->init_reg (gdbarch, regnum, reg, next_frame); } /* Set the architecture-specific signal trampoline recognition @@ -713,7 +717,7 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache) int regnum; for (regnum = 0; regnum < num_regs; regnum++) - dwarf2_frame_init_reg (gdbarch, regnum, &cache->reg[regnum]); + dwarf2_frame_init_reg (gdbarch, regnum, &cache->reg[regnum], next_frame); } /* Go through the DWARF2 CFI generated table and save its register diff --git a/gdb/dwarf2-frame.h b/gdb/dwarf2-frame.h index 3194604..a4ad586 100644 --- a/gdb/dwarf2-frame.h +++ b/gdb/dwarf2-frame.h @@ -79,7 +79,8 @@ struct dwarf2_frame_state_reg extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, void (*init_reg) (struct gdbarch *, int, - struct dwarf2_frame_state_reg *)); + struct dwarf2_frame_state_reg *, + struct frame_info *)); /* Set the architecture-specific signal trampoline recognition function for GDBARCH to SIGNAL_FRAME_P. */ diff --git a/gdb/exec.c b/gdb/exec.c index 248f7ee..7bd2ccd 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -59,8 +59,6 @@ static void set_section_command (char *, int); static void exec_files_info (struct target_ops *); -static int ignore (CORE_ADDR, bfd_byte *); - static void init_exec_ops (void); void _initialize_exec (void); @@ -691,7 +689,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address) breakpoint_init_inferior). */ static int -ignore (CORE_ADDR addr, bfd_byte *contents) +ignore (struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/frame.h b/gdb/frame.h index a73a4f1..800cbfb 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -300,6 +300,12 @@ extern CORE_ADDR get_frame_func (struct frame_info *fi); extern void find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal); +/* Set the current source and line to the location given by frame + FRAME, if possible. When CENTER is true, adjust so the relevant + line is in the center of the next 'list'. */ + +void set_current_sal_from_frame (struct frame_info *, int); + /* Return the frame base (what ever that is) (DEPRECATED). Old code was trying to use this single method for two conflicting diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 4fa5ea4..706bd13 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -1250,8 +1250,8 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) #ifdef MEMORY_INSERT_BREAKPOINT fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", - "MEMORY_INSERT_BREAKPOINT(addr, contents_cache)", - XSTRING (MEMORY_INSERT_BREAKPOINT (addr, contents_cache))); + "MEMORY_INSERT_BREAKPOINT(bp_tgt)", + XSTRING (MEMORY_INSERT_BREAKPOINT (bp_tgt))); #endif fprintf_unfiltered (file, "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n", @@ -1259,8 +1259,8 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) #ifdef MEMORY_REMOVE_BREAKPOINT fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", - "MEMORY_REMOVE_BREAKPOINT(addr, contents_cache)", - XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, contents_cache))); + "MEMORY_REMOVE_BREAKPOINT(bp_tgt)", + XSTRING (MEMORY_REMOVE_BREAKPOINT (bp_tgt))); #endif fprintf_unfiltered (file, "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n", @@ -2934,13 +2934,13 @@ set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, } int -gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache) +gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->memory_insert_breakpoint != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n"); - return gdbarch->memory_insert_breakpoint (addr, contents_cache); + return gdbarch->memory_insert_breakpoint (bp_tgt); } void @@ -2951,13 +2951,13 @@ set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, } int -gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache) +gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->memory_remove_breakpoint != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n"); - return gdbarch->memory_remove_breakpoint (addr, contents_cache); + return gdbarch->memory_remove_breakpoint (bp_tgt); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 75ac81f..48bcd7a 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -49,6 +49,7 @@ struct regset; struct disassemble_info; struct target_ops; struct obstack; +struct bp_target_info; extern struct gdbarch *current_gdbarch; @@ -899,24 +900,24 @@ typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdb extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr); extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address); -typedef int (gdbarch_memory_insert_breakpoint_ftype) (CORE_ADDR addr, gdb_byte *contents_cache); -extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache); +typedef int (gdbarch_memory_insert_breakpoint_ftype) (struct bp_target_info *bp_tgt); +extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint); #if !defined (GDB_TM_FILE) && defined (MEMORY_INSERT_BREAKPOINT) #error "Non multi-arch definition of MEMORY_INSERT_BREAKPOINT" #endif #if !defined (MEMORY_INSERT_BREAKPOINT) -#define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) (gdbarch_memory_insert_breakpoint (current_gdbarch, addr, contents_cache)) +#define MEMORY_INSERT_BREAKPOINT(bp_tgt) (gdbarch_memory_insert_breakpoint (current_gdbarch, bp_tgt)) #endif -typedef int (gdbarch_memory_remove_breakpoint_ftype) (CORE_ADDR addr, gdb_byte *contents_cache); -extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache); +typedef int (gdbarch_memory_remove_breakpoint_ftype) (struct bp_target_info *bp_tgt); +extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt); extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint); #if !defined (GDB_TM_FILE) && defined (MEMORY_REMOVE_BREAKPOINT) #error "Non multi-arch definition of MEMORY_REMOVE_BREAKPOINT" #endif #if !defined (MEMORY_REMOVE_BREAKPOINT) -#define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) (gdbarch_memory_remove_breakpoint (current_gdbarch, addr, contents_cache)) +#define MEMORY_REMOVE_BREAKPOINT(bp_tgt) (gdbarch_memory_remove_breakpoint (current_gdbarch, bp_tgt)) #endif extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index afcfd82..9e36fb6 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -549,8 +549,8 @@ f:=:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0 f:=:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0 f:=:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0: M::CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr -f:=:int:memory_insert_breakpoint:CORE_ADDR addr, gdb_byte *contents_cache:addr, contents_cache:0:default_memory_insert_breakpoint::0 -f:=:int:memory_remove_breakpoint:CORE_ADDR addr, gdb_byte *contents_cache:addr, contents_cache:0:default_memory_remove_breakpoint::0 +f:=:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0 +f:=:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0 v:=:CORE_ADDR:decr_pc_after_break:::0:::0 # A function can be addressed by either it's "pointer" (possibly a @@ -771,6 +771,7 @@ struct regset; struct disassemble_info; struct target_ops; struct obstack; +struct bp_target_info; extern struct gdbarch *current_gdbarch; EOF diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c index 439a6e0..c5d23f9 100644 --- a/gdb/hppa-linux-tdep.c +++ b/gdb/hppa-linux-tdep.c @@ -30,6 +30,7 @@ #include "trad-frame.h" #include "dwarf2-frame.h" #include "value.h" +#include "regset.h" #include "hppa-tdep.h" #include "elf/common.h" @@ -400,6 +401,112 @@ hppa_linux_find_global_pointer (struct value *function) } return 0; } + +/* + * Registers saved in a coredump: + * gr0..gr31 + * sr0..sr7 + * iaoq0..iaoq1 + * iasq0..iasq1 + * sar, iir, isr, ior, ipsw + * cr0, cr24..cr31 + * cr8,9,12,13 + * cr10, cr15 + */ + +#define GR_REGNUM(_n) (HPPA_R0_REGNUM+_n) +#define TR_REGNUM(_n) (HPPA_TR0_REGNUM+_n) +static const int greg_map[] = + { + GR_REGNUM(0), GR_REGNUM(1), GR_REGNUM(2), GR_REGNUM(3), + GR_REGNUM(4), GR_REGNUM(5), GR_REGNUM(6), GR_REGNUM(7), + GR_REGNUM(8), GR_REGNUM(9), GR_REGNUM(10), GR_REGNUM(11), + GR_REGNUM(12), GR_REGNUM(13), GR_REGNUM(14), GR_REGNUM(15), + GR_REGNUM(16), GR_REGNUM(17), GR_REGNUM(18), GR_REGNUM(19), + GR_REGNUM(20), GR_REGNUM(21), GR_REGNUM(22), GR_REGNUM(23), + GR_REGNUM(24), GR_REGNUM(25), GR_REGNUM(26), GR_REGNUM(27), + GR_REGNUM(28), GR_REGNUM(29), GR_REGNUM(30), GR_REGNUM(31), + + HPPA_SR4_REGNUM+1, HPPA_SR4_REGNUM+2, HPPA_SR4_REGNUM+3, HPPA_SR4_REGNUM+4, + HPPA_SR4_REGNUM, HPPA_SR4_REGNUM+5, HPPA_SR4_REGNUM+6, HPPA_SR4_REGNUM+7, + + HPPA_PCOQ_HEAD_REGNUM, HPPA_PCOQ_TAIL_REGNUM, + HPPA_PCSQ_HEAD_REGNUM, HPPA_PCSQ_TAIL_REGNUM, + + HPPA_SAR_REGNUM, HPPA_IIR_REGNUM, HPPA_ISR_REGNUM, HPPA_IOR_REGNUM, + HPPA_IPSW_REGNUM, HPPA_RCR_REGNUM, + + TR_REGNUM(0), TR_REGNUM(1), TR_REGNUM(2), TR_REGNUM(3), + TR_REGNUM(4), TR_REGNUM(5), TR_REGNUM(6), TR_REGNUM(7), + + HPPA_PID0_REGNUM, HPPA_PID1_REGNUM, HPPA_PID2_REGNUM, HPPA_PID3_REGNUM, + HPPA_CCR_REGNUM, HPPA_EIEM_REGNUM, + }; + +static void +hppa_linux_supply_regset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *regs, size_t len) +{ + struct gdbarch *arch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (arch); + const char *buf = regs; + int i, offset; + + offset = 0; + for (i = 0; i < ARRAY_SIZE (greg_map); i++) + { + if (regnum == greg_map[i] || regnum == -1) + regcache_raw_supply (regcache, greg_map[i], buf + offset); + + offset += tdep->bytes_per_address; + } +} + +static void +hppa_linux_supply_fpregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *regs, size_t len) +{ + const char *buf = regs; + int i, offset; + + offset = 0; + for (i = 0; i < 31; i++) + { + if (regnum == HPPA_FP0_REGNUM + i || regnum == -1) + regcache_raw_supply (regcache, HPPA_FP0_REGNUM + i, + buf + offset); + offset += 8; + } +} + +/* Linux register set. */ +static struct regset hppa_linux_regset = +{ + NULL, + hppa_linux_supply_regset +}; + +static struct regset hppa_linux_fpregset = +{ + NULL, + hppa_linux_supply_fpregset +}; + +static const struct regset * +hppa_linux_regset_from_core_section (struct gdbarch *gdbarch, + const char *sect_name, + size_t sect_size) +{ + if (strcmp (sect_name, ".reg") == 0) + return &hppa_linux_regset; + else if (strcmp (sect_name, ".reg2") == 0) + return &hppa_linux_fpregset; + + return NULL; +} + /* Forward declarations. */ extern initialize_file_ftype _initialize_hppa_linux_tdep; @@ -433,6 +540,9 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) more work in gcc and glibc first. */ set_gdbarch_long_double_bit (gdbarch, 64); + set_gdbarch_regset_from_core_section + (gdbarch, hppa_linux_regset_from_core_section); + #if 0 /* Dwarf-2 unwinding support. Not yet working. */ set_gdbarch_dwarf_reg_to_regnum (gdbarch, hppa_dwarf_reg_to_regnum); @@ -450,4 +560,5 @@ void _initialize_hppa_linux_tdep (void) { gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_LINUX, hppa_linux_init_abi); + gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w, GDB_OSABI_LINUX, hppa_linux_init_abi); } diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index f1ae88c..50dac1b 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1782,6 +1782,17 @@ hppa_skip_prologue (CORE_ADDR pc) return (skip_prologue_hard_way (pc, 1)); } +/* Return an unwind entry that falls within the frame's code block. */ +static struct unwind_table_entry * +hppa_find_unwind_entry_in_block (struct frame_info *f) +{ + CORE_ADDR pc; + + pc = frame_unwind_address_in_block (f); + pc = gdbarch_addr_bits_remove (get_frame_arch (f), pc); + return find_unwind_entry (pc); +} + struct hppa_frame_cache { CORE_ADDR base; @@ -1817,7 +1828,7 @@ hppa_frame_cache (struct frame_info *next_frame, void **this_cache) cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); /* Yow! */ - u = find_unwind_entry (frame_pc_unwind (next_frame)); + u = hppa_find_unwind_entry_in_block (next_frame); if (!u) { if (hppa_debug) @@ -2197,7 +2208,7 @@ hppa_frame_this_id (struct frame_info *next_frame, void **this_cache, struct unwind_table_entry *u; info = hppa_frame_cache (next_frame, this_cache); - u = find_unwind_entry (pc); + u = hppa_find_unwind_entry_in_block (next_frame); (*this_id) = frame_id_build (info->base, u->region_start); } @@ -2224,9 +2235,7 @@ static const struct frame_unwind hppa_frame_unwind = static const struct frame_unwind * hppa_frame_unwind_sniffer (struct frame_info *next_frame) { - CORE_ADDR pc = frame_pc_unwind (next_frame); - - if (find_unwind_entry (pc)) + if (hppa_find_unwind_entry_in_block (next_frame)) return &hppa_frame_unwind; return NULL; diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 770b66d..dea1206 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -625,12 +625,13 @@ i386_stopped_by_hwbp (void) return 0; } -/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is - unused. Return 0 on success, EBUSY on failure. */ +/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. + Return 0 on success, EBUSY on failure. */ int -i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow) +i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt) { unsigned len_rw = i386_length_and_rw_bits (1, hw_execute); + CORE_ADDR addr = bp_tgt->placed_address; int retval = i386_insert_aligned_watchpoint (addr, len_rw) ? EBUSY : 0; if (maint_show_dr) @@ -639,13 +640,14 @@ i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow) return retval; } -/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is - unused. Return 0 on success, -1 on failure. */ +/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address. + Return 0 on success, -1 on failure. */ int -i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow) +i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt) { unsigned len_rw = i386_length_and_rw_bits (1, hw_execute); + CORE_ADDR addr = bp_tgt->placed_address; int retval = i386_remove_aligned_watchpoint (addr, len_rw); if (maint_show_dr) diff --git a/gdb/i386-stub.c b/gdb/i386-stub.c index 1251567..6b91296 100644 --- a/gdb/i386-stub.c +++ b/gdb/i386-stub.c @@ -474,7 +474,7 @@ getpacket (void) count = 0; /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '$') diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index f78f1fc..897d272 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -550,8 +550,9 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr) #define IA64_BREAKPOINT 0x00003333300LL static int -ia64_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +ia64_memory_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; char bundle[BUNDLE_LEN]; int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER; long long instr; @@ -574,7 +575,8 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) } instr = slotN_contents (bundle, slotnum); - memcpy(contents_cache, &instr, sizeof(instr)); + memcpy (bp_tgt->shadow_contents, &instr, sizeof (instr)); + bp_tgt->placed_size = bp_tgt->shadow_len = sizeof (instr); replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum); if (val == 0) target_write_memory (addr, bundle, BUNDLE_LEN); @@ -583,8 +585,9 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) } static int -ia64_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +ia64_memory_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; char bundle[BUNDLE_LEN]; int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER; long long instr; @@ -603,7 +606,7 @@ ia64_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) slotnum = 2; } - memcpy (&instr, contents_cache, sizeof instr); + memcpy (&instr, bp_tgt->shadow_contents, sizeof instr); replace_slotN_contents (bundle, instr, slotnum); if (val == 0) target_write_memory (addr, bundle, BUNDLE_LEN); diff --git a/gdb/infrun.c b/gdb/infrun.c index 47fbe09..bccca0d 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3044,6 +3044,12 @@ Further execution is probably impossible.\n")); target_terminal_ours (); + /* Set the current source location. This will also happen if we + display the frame below, but the current SAL will be incorrect + during a user hook-stop function. */ + if (target_has_stack && !stop_stack_dummy) + set_current_sal_from_frame (get_current_frame (), 1); + /* Look up the hook_stop and run it (CLI internally handles problem of stop_command's pre-hook not existing). */ if (stop_command) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 88e0d7d..f050e7e 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -334,12 +334,14 @@ void child_post_attach (int pid) { linux_enable_event_reporting (pid_to_ptid (pid)); + check_for_thread_db (); } static void linux_child_post_startup_inferior (ptid_t ptid) { linux_enable_event_reporting (ptid); + check_for_thread_db (); } int @@ -963,7 +965,7 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose) gdb_assert (pid == GET_LWP (ptid) && WIFSTOPPED (status) && WSTOPSIG (status)); - child_post_attach (pid); + target_post_attach (pid); lp->stopped = 1; @@ -2380,7 +2382,13 @@ linux_nat_thread_alive (ptid_t ptid) "LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n", target_pid_to_str (ptid), errno ? safe_strerror (errno) : "OK"); - if (errno) + + /* Not every Linux target implements PTRACE_PEEKUSER. + But we can handle that case gracefully since ptrace + will first do a lookup for the process based upon the + passed-in pid. If that fails we will get either -ESRCH + or -EPERM, otherwise the child exists and is alive. */ + if (errno == ESRCH || errno == EPERM) return 0; return 1; diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index ecfaab7..b7cc92a 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -65,6 +65,8 @@ struct lwp_info struct lwp_info *next; }; +/* Attempt to initialize libthread_db. */ +void check_for_thread_db (void); /* Find process PID's pending signal set from /proc/pid/status. */ void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored); diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 1291480..981bc06 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -37,6 +37,7 @@ #include "regcache.h" #include "solib-svr4.h" #include "gdbcore.h" +#include "linux-nat.h" #ifdef HAVE_GNU_LIBC_VERSION_H #include @@ -626,59 +627,49 @@ check_thread_signals (void) #endif } -static void -thread_db_new_objfile (struct objfile *objfile) +/* Check whether thread_db is usable. This function is called when + an inferior is created (or otherwise acquired, e.g. attached to) + and when new shared libraries are loaded into a running process. */ + +void +check_for_thread_db (void) { td_err_e err; + static int already_loaded; /* First time through, report that libthread_db was successfuly loaded. Can't print this in in thread_db_load as, at that stage, - the interpreter and it's console haven't started. The real - problem here is that libthread_db is loaded too early - it should - only be loaded when there is a program to debug. */ - { - static int dejavu; - if (!dejavu) - { - Dl_info info; - const char *library = NULL; - /* Try dladdr. */ - if (dladdr ((*td_ta_new_p), &info) != 0) - library = info.dli_fname; - /* Try dlinfo? */ - if (library == NULL) - /* Paranoid - don't let a NULL path slip through. */ - library = LIBTHREAD_DB_SO; - printf_unfiltered (_("Using host libthread_db library \"%s\".\n"), - library); - dejavu = 1; - } - } + the interpreter and it's console haven't started. */ - /* Don't attempt to use thread_db on targets which can not run - (core files). */ - if (objfile == NULL || !target_has_execution) + if (!already_loaded) { - /* All symbols have been discarded. If the thread_db target is - active, deactivate it now. */ - if (using_thread_db) - { - gdb_assert (proc_handle.pid == 0); - unpush_target (&thread_db_ops); - using_thread_db = 0; - } + Dl_info info; + const char *library = NULL; + if (dladdr ((*td_ta_new_p), &info) != 0) + library = info.dli_fname; + + /* Try dlinfo? */ + + if (library == NULL) + /* Paranoid - don't let a NULL path slip through. */ + library = LIBTHREAD_DB_SO; - goto quit; + printf_unfiltered (_("Using host libthread_db library \"%s\".\n"), + library); + already_loaded = 1; } if (using_thread_db) /* Nothing to do. The thread library was already detected and the target vector was already activated. */ - goto quit; + return; - /* Initialize the structure that identifies the child process. Note - that at this point there is no guarantee that we actually have a - child process. */ + /* Don't attempt to use thread_db on targets which can not run + (executables not running yet, core files) for now. */ + if (!target_has_execution) + return; + + /* Initialize the structure that identifies the child process. */ proc_handle.pid = GET_PID (inferior_ptid); /* Now attempt to open a connection to the thread library. */ @@ -705,8 +696,14 @@ thread_db_new_objfile (struct objfile *objfile) thread_db_err_str (err)); break; } +} + +static void +thread_db_new_objfile (struct objfile *objfile) +{ + if (objfile != NULL) + check_for_thread_db (); -quit: if (target_new_objfile_chain) target_new_objfile_chain (objfile); } diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index ca8b29e..a31e0d2 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -46,12 +46,16 @@ /* * All this stuff just to get my host computer's IP address! */ +#ifdef __MINGW32__ +#include +#else #include #include /* for hostent */ #include /* for struct in_addr */ #if 1 #include /* for inet_ntoa */ #endif +#endif static char *board_addr; /* user-settable IP address for M32R-EVA */ static char *server_addr; /* user-settable IP address for gdb host */ @@ -435,6 +439,13 @@ m32r_upload_command (char *args, int from_tty) } if (server_addr == 0) { +#ifdef __MINGW32__ + WSADATA wd; + /* Winsock initialization. */ + if (WSAStartup (MAKEWORD (1, 1), &wd)) + error (_("Couldn't initialize WINSOCK.")); +#endif + buf[0] = 0; gethostname (buf, sizeof (buf)); if (buf[0] != 0) diff --git a/gdb/m32r-stub.c b/gdb/m32r-stub.c index c7033ea..4d54f72 100644 --- a/gdb/m32r-stub.c +++ b/gdb/m32r-stub.c @@ -605,7 +605,7 @@ getpacket (void) count = 0; /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '$') diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index c95dbd1..e792c4c 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -81,10 +81,12 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) The following functions take care of this behavior. */ static int -m32r_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +m32r_memory_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int val; gdb_byte buf[4]; + gdb_byte *contents_cache = bp_tgt->shadow_contents; gdb_byte bp_entry[] = { 0x10, 0xf1 }; /* dpt */ /* Save the memory contents. */ @@ -92,6 +94,8 @@ m32r_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) if (val != 0) return val; /* return error */ + bp_tgt->placed_size = bp_tgt->shadow_len = 4; + /* Determine appropriate breakpoint contents and size for this address. */ if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) { @@ -134,10 +138,12 @@ m32r_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) } static int -m32r_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +m32r_memory_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int val; gdb_byte buf[4]; + gdb_byte *contents_cache = bp_tgt->shadow_contents; buf[0] = contents_cache[0]; buf[1] = contents_cache[1]; diff --git a/gdb/m68k-stub.c b/gdb/m68k-stub.c index 54e06b1..4ef4069 100644 --- a/gdb/m68k-stub.c +++ b/gdb/m68k-stub.c @@ -553,7 +553,7 @@ getpacket (void) count = 0; /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '$') diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c index 6da4d15..3f3a4d9 100644 --- a/gdb/m68klinux-tdep.c +++ b/gdb/m68klinux-tdep.c @@ -248,7 +248,7 @@ m68k_linux_sigtramp_frame_prev_register (struct frame_info *next_frame, int regnum, int *optimizedp, enum lval_type *lvalp, CORE_ADDR *addrp, - int *realnump, void *valuep) + int *realnump, gdb_byte *valuep) { /* Make sure we've initialized the cache. */ struct trad_frame_cache *cache = diff --git a/gdb/mem-break.c b/gdb/mem-break.c index 810f8ae..2d9851b 100644 --- a/gdb/mem-break.c +++ b/gdb/mem-break.c @@ -33,60 +33,57 @@ #include "target.h" -/* Insert a breakpoint on targets that don't have any better breakpoint - support. We read the contents of the target location and stash it, - then overwrite it with a breakpoint instruction. ADDR is the target - location in the target machine. CONTENTS_CACHE is a pointer to - memory allocated for saving the target contents. It is guaranteed - by the caller to be long enough to save BREAKPOINT_LEN bytes (this - is accomplished via BREAKPOINT_MAX). */ +/* Insert a breakpoint on targets that don't have any better + breakpoint support. We read the contents of the target location + and stash it, then overwrite it with a breakpoint instruction. + BP_TGT->placed_address is the target location in the target + machine. BP_TGT->shadow_contents is some memory allocated for + saving the target contents. It is guaranteed by the caller to be + long enough to save BREAKPOINT_LEN bytes (this is accomplished via + BREAKPOINT_MAX). */ int -default_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +default_memory_insert_breakpoint (struct bp_target_info *bp_tgt) { int val; const unsigned char *bp; int bplen; /* Determine appropriate breakpoint contents and size for this address. */ - bp = BREAKPOINT_FROM_PC (&addr, &bplen); + bp = BREAKPOINT_FROM_PC (&bp_tgt->placed_address, &bp_tgt->placed_size); if (bp == NULL) error (_("Software breakpoints not implemented for this target.")); /* Save the memory contents. */ - val = target_read_memory (addr, contents_cache, bplen); + bp_tgt->shadow_len = bp_tgt->placed_size; + val = target_read_memory (bp_tgt->placed_address, bp_tgt->shadow_contents, + bp_tgt->placed_size); /* Write the breakpoint. */ if (val == 0) - val = target_write_memory (addr, bp, bplen); + val = target_write_memory (bp_tgt->placed_address, bp, + bp_tgt->placed_size); return val; } int -default_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +default_memory_remove_breakpoint (struct bp_target_info *bp_tgt) { - const bfd_byte *bp; - int bplen; - - /* Determine appropriate breakpoint contents and size for this address. */ - bp = BREAKPOINT_FROM_PC (&addr, &bplen); - if (bp == NULL) - error (_("Software breakpoints not implemented for this target.")); - - return target_write_memory (addr, contents_cache, bplen); + return target_write_memory (bp_tgt->placed_address, bp_tgt->shadow_contents, + bp_tgt->placed_size); } int -memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +memory_insert_breakpoint (struct bp_target_info *bp_tgt) { - return MEMORY_INSERT_BREAKPOINT(addr, contents_cache); + return MEMORY_INSERT_BREAKPOINT (bp_tgt); } int -memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +memory_remove_breakpoint (struct bp_target_info *bp_tgt) { - return MEMORY_REMOVE_BREAKPOINT(addr, contents_cache); + return MEMORY_REMOVE_BREAKPOINT (bp_tgt); } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 880dfcc..dcb4406 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2188,20 +2188,17 @@ mips_addr_bits_remove (CORE_ADDR addr) void mips_software_single_step (enum target_signal sig, int insert_breakpoints_p) { - static CORE_ADDR next_pc; - typedef char binsn_quantum[BREAKPOINT_MAX]; - static binsn_quantum break_mem; - CORE_ADDR pc; + CORE_ADDR pc, next_pc; if (insert_breakpoints_p) { pc = read_register (mips_regnum (current_gdbarch)->pc); next_pc = mips_next_pc (pc); - target_insert_breakpoint (next_pc, break_mem); + insert_single_step_breakpoint (next_pc); } else - target_remove_breakpoint (next_pc, break_mem); + remove_single_step_breakpoints (); } /* Test whether the PC points to the return instruction at the diff --git a/gdb/monitor.c b/gdb/monitor.c index 3b7619e..a6c0823 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -85,8 +85,6 @@ static int monitor_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, struct mem_attrib *attrib, struct target_ops *target); static void monitor_files_info (struct target_ops *ops); -static int monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow); -static int monitor_remove_breakpoint (CORE_ADDR addr, gdb_byte *shadow); static void monitor_kill (void); static void monitor_load (char *file, int from_tty); static void monitor_mourn_inferior (void); @@ -2037,8 +2035,9 @@ monitor_mourn_inferior (void) /* Tell the monitor to add a breakpoint. */ static int -monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow) +monitor_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; const unsigned char *bp; int bplen; @@ -2052,13 +2051,14 @@ monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow) /* Determine appropriate breakpoint size for this address. */ bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen); + bp_tgt->placed_address = addr; + bp_tgt->placed_size = bplen; for (i = 0; i < current_monitor->num_breakpoints; i++) { if (breakaddr[i] == 0) { breakaddr[i] = addr; - monitor_read_memory (addr, shadow, bplen); monitor_printf (current_monitor->set_break, addr); monitor_expect_prompt (NULL, 0); return 0; @@ -2071,17 +2071,15 @@ monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow) /* Tell the monitor to remove a breakpoint. */ static int -monitor_remove_breakpoint (CORE_ADDR addr, gdb_byte *shadow) +monitor_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; monitor_debug ("MON rmbkpt %s\n", paddr (addr)); if (current_monitor->clr_break == NULL) error (_("No clr_break defined for this monitor")); - if (current_monitor->flags & MO_ADDR_BITS_REMOVE) - addr = ADDR_BITS_REMOVE (addr); - for (i = 0; i < current_monitor->num_breakpoints; i++) { if (breakaddr[i] == addr) diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 7854d2a..6dc056a 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -76,10 +76,6 @@ static ptid_t do_attach (ptid_t ptid); static int procfs_can_use_hw_breakpoint (int, int, int); -static int procfs_insert_hw_breakpoint (CORE_ADDR, char *); - -static int procfs_remove_hw_breakpoint (CORE_ADDR addr, char *); - static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type); static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type); @@ -812,27 +808,29 @@ procfs_breakpoint (CORE_ADDR addr, int type, int size) } static int -procfs_insert_breakpoint (CORE_ADDR addr, char *contents_cache) +procfs_insert_breakpoint (struct bp_target_info *bp_tgt) { - return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, 0); + return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, 0); } static int -procfs_remove_breakpoint (CORE_ADDR addr, char *contents_cache) +procfs_remove_breakpoint (struct bp_target_info *bp_tgt) { - return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, -1); + return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, -1); } static int -procfs_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache) +procfs_insert_hw_breakpoint (struct bp_target_info *bp_tgt) { - return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0); + return procfs_breakpoint (bp_tgt->placed_address, + _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0); } static int -procfs_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache) +procfs_remove_hw_breakpoint (struct bp_target_info *bp_tgt) { - return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1); + return procfs_breakpoint (bp_tgt->placed_address, + _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1); } static void diff --git a/gdb/ocd.c b/gdb/ocd.c index 79726d2..10b0709 100644 --- a/gdb/ocd.c +++ b/gdb/ocd.c @@ -1048,28 +1048,27 @@ ocd_load (char *args, int from_tty) /* BDM (at least on CPU32) uses a different breakpoint */ int -ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache) +ocd_insert_breakpoint (struct bp_target_info *bp_tgt) { static char break_insn[] = BDM_BREAKPOINT; int val; - val = target_read_memory (addr, contents_cache, sizeof (break_insn)); + bp_tgt->placed_size = bp_tgt->shadow_len = sizeof (break_insn); + val = target_read_memory (bp_tgt->placed_address, bp_tgt->shadow_contents, + bp_tgt->placed_size); if (val == 0) - val = target_write_memory (addr, break_insn, sizeof (break_insn)); + val = target_write_memory (bp_tgt->placed_address, break_insn, + bp_tgt->placed_size); return val; } int -ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache) +ocd_remove_breakpoint (struct bp_target_info *bp_tgt) { - static char break_insn[] = BDM_BREAKPOINT; - int val; - - val = target_write_memory (addr, contents_cache, sizeof (break_insn)); - - return val; + return target_write_memory (bp_tgt->placed_address, bp_tgt->shadow_contents, + bp_tgt->placed_size); } static void diff --git a/gdb/ocd.h b/gdb/ocd.h index 35b555b..007984b 100644 --- a/gdb/ocd.h +++ b/gdb/ocd.h @@ -135,8 +135,8 @@ void ocd_write_bdm_register (int bdm_regno, CORE_ADDR reg); int ocd_wait (void); -int ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache); -int ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache); +int ocd_insert_breakpoint (struct bp_target_info *bp_tgt); +int ocd_remove_breakpoint (struct bp_target_info *bp_tgt); int ocd_write_bytes (CORE_ADDR memaddr, char *myaddr, int len); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 0452084..5e1bc00 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -457,9 +457,9 @@ ppc_linux_skip_trampoline_code (CORE_ADDR pc) regard to removing breakpoints in some potentially self modifying code. */ int -ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, - gdb_byte *contents_cache) +ppc_linux_memory_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; const unsigned char *bp; int val; int bplen; @@ -476,7 +476,7 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, program modified the code on us, so it is wrong to put back the old value */ if (val == 0 && memcmp (bp, old_contents, bplen) == 0) - val = target_write_memory (addr, contents_cache, bplen); + val = target_write_memory (addr, bp_tgt->shadow_contents, bplen); return val; } diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index 1a25648..f781f1b 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -56,8 +56,7 @@ CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR struct_addr); CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr); -int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, - gdb_byte *contents_cache); +int ppc_linux_memory_remove_breakpoint (struct bp_target_info *bp_tgt); struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void); void ppc_linux_supply_gregset (struct regcache *regcache, int regnum, const void *gregs, size_t size, diff --git a/gdb/procfs.c b/gdb/procfs.c index 1fd45a3..03fcadd 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3375,7 +3375,7 @@ static void remove_dbx_link_breakpoint (void); the address of the breakpoint, and the code that was replaced by a breakpoint. */ static int dbx_link_bpt_addr = 0; -static char dbx_link_shadow_contents[BREAKPOINT_MAX]; +static void *dbx_link_bpt; /* * Function: procfs_debug_inferior @@ -4777,6 +4777,14 @@ procfs_mourn_inferior (void) destroy_procinfo (pi); } unpush_target (&procfs_ops); + + if (dbx_link_bpt != NULL) + { + deprecated_remove_raw_breakpoint (dbx_link_bpt); + dbx_link_bpt_addr = 0; + dbx_link_bpt = NULL; + } + generic_mourn_inferior (); } @@ -4886,7 +4894,6 @@ procfs_init_inferior (int pid) has been inserted, the syssgi() notifications are no longer necessary, so they should be canceled. */ proc_trace_syscalls_1 (pi, SYS_syssgi, PR_SYSEXIT, FLAG_SET, 0); - dbx_link_bpt_addr = 0; #endif } @@ -5571,11 +5578,11 @@ remove_dbx_link_breakpoint (void) if (dbx_link_bpt_addr == 0) return; - if (memory_remove_breakpoint (dbx_link_bpt_addr, - dbx_link_shadow_contents) != 0) + if (deprecated_remove_raw_breakpoint (dbx_link_bpt) != 0) warning (_("Unable to remove __dbx_link breakpoint.")); dbx_link_bpt_addr = 0; + dbx_link_bpt = NULL; } /* Return the address of the __dbx_link() function in the file @@ -5643,7 +5650,8 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) { /* Insert the breakpoint. */ dbx_link_bpt_addr = sym_addr; - if (target_insert_breakpoint (sym_addr, dbx_link_shadow_contents) != 0) + dbx_link_bpt = deprecated_insert_raw_breakpoint (sym_addr); + if (dbx_link_bpt == NULL) { warning (_("Failed to insert dbx_link breakpoint.")); bfd_close (abfd); diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 09a9460..c1575ca 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -1702,8 +1702,9 @@ static CORE_ADDR breakaddr[MAX_BREAKPOINTS] = {0}; static int -e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow) +e7000_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; char buf[200]; #if 0 @@ -1728,7 +1729,8 @@ e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow) } #else #if 0 - e7000_read_inferior_memory (addr, shadow, 2); + bp_tgt->shadow_len = 2; + e7000_read_inferior_memory (addr, bp_tgt->shadow_contents, 2); e7000_write_inferior_memory (addr, nop, 2); #endif @@ -1745,8 +1747,9 @@ e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow) } static int -e7000_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow) +e7000_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; char buf[200]; @@ -1773,7 +1776,8 @@ e7000_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow) #if 0 /* Replace the insn under the break */ - e7000_write_inferior_memory (addr, shadow, 2); + e7000_write_inferior_memory (addr, bp_tgt->shadow_contents, + bp_tgt->shadow_len); #endif #endif diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 9ef526f..b203316 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -31,7 +31,11 @@ #include "gdb_string.h" #include #include +#ifdef __MINGW32__ +#include +#else #include +#endif #include #include #include @@ -1141,15 +1145,16 @@ m32r_mourn_inferior (void) } static int -m32r_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow) +m32r_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int ib_breakpoints; unsigned char buf[13]; int i, c; if (remote_debug) - fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%08lx,\"%s\")\n", - addr, shadow); + fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%08lx,...)\n", + addr); if (use_ib_breakpoints) ib_breakpoints = max_ib_breakpoints; @@ -1183,13 +1188,14 @@ m32r_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow) } static int -m32r_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow) +m32r_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; if (remote_debug) - fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%08lx,\"%s\")\n", - addr, shadow); + fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%08lx)\n", + addr); for (i = 0; i < MAX_BREAKPOINTS; i++) { diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index e47aa6e..1144e8d 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2216,27 +2216,28 @@ mips_mourn_inferior (void) /* Insert a breakpoint. On targets that don't have built-in breakpoint support, we read the contents of the target location and stash it, then overwrite it with a breakpoint instruction. ADDR is - the target location in the target machine. CONTENTS_CACHE is a - pointer to memory allocated for saving the target contents. It is - guaranteed by the caller to be long enough to save the breakpoint - length returned by BREAKPOINT_FROM_PC. */ + the target location in the target machine. BPT is the breakpoint + being inserted or removed, which contains memory for saving the + target contents. */ static int -mips_insert_breakpoint (CORE_ADDR addr, char *contents_cache) +mips_insert_breakpoint (struct bp_target_info *bp_tgt) { if (monitor_supports_breakpoints) - return set_breakpoint (addr, MIPS_INSN32_SIZE, BREAK_FETCH); + return set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE, + BREAK_FETCH); else - return memory_insert_breakpoint (addr, contents_cache); + return memory_insert_breakpoint (bp_tgt); } static int -mips_remove_breakpoint (CORE_ADDR addr, char *contents_cache) +mips_remove_breakpoint (struct bp_target_info *bp_tgt) { if (monitor_supports_breakpoints) - return clear_breakpoint (addr, MIPS_INSN32_SIZE, BREAK_FETCH); + return clear_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE, + BREAK_FETCH); else - return memory_remove_breakpoint (addr, contents_cache); + return memory_remove_breakpoint (bp_tgt); } /* Tell whether this target can support a hardware breakpoint. CNT diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 695156d..e94821f 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -1050,8 +1050,10 @@ rdp_execute (void) } static int -remote_rdp_insert_breakpoint (CORE_ADDR addr, bfd_byte *save) +remote_rdp_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; + int res; if (ds.rdi_level > 0) { @@ -1059,7 +1061,7 @@ remote_rdp_insert_breakpoint (CORE_ADDR addr, bfd_byte *save) RDP_SET_BREAK, addr, RDP_SET_BREAK_TYPE_PC_EQUAL | RDP_SET_BREAK_TYPE_GET_HANDLE, - save, + bp_tgt->shadow_contents, &res); } else @@ -1074,14 +1076,15 @@ remote_rdp_insert_breakpoint (CORE_ADDR addr, bfd_byte *save) } static int -remote_rdp_remove_breakpoint (CORE_ADDR addr, bfd_byte *save) +remote_rdp_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int res; if (ds.rdi_level > 0) { send_rdp ("b-p-S-B", RDP_CLEAR_BREAK, - save, 4, + bp_tgt->shadow_contents, 4, &res); } else @@ -1108,12 +1111,12 @@ rdp_step (void) } else { - char handle[4]; + void *b; CORE_ADDR pc = read_register (ARM_PC_REGNUM); pc = arm_get_next_pc (pc); - remote_rdp_insert_breakpoint (pc, handle); + b = deprecated_insert_raw_breakpoint (pc); rdp_execute (); - remote_rdp_remove_breakpoint (pc, handle); + deprecated_remove_raw_breakpoint (b); } } diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c index 7533107..8394ae5 100644 --- a/gdb/remote-sds.c +++ b/gdb/remote-sds.c @@ -99,10 +99,6 @@ static void interrupt_query (void); static int read_frame (char *); -static int sds_insert_breakpoint (CORE_ADDR, char *); - -static int sds_remove_breakpoint (CORE_ADDR, char *); - static void init_sds_ops (void); static void sds_command (char *args, int from_tty); @@ -1004,8 +1000,9 @@ sds_load (char *filename, int from_tty) replaced instruction back to the debugger. */ static int -sds_insert_breakpoint (CORE_ADDR addr, char *contents_cache) +sds_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i, retlen; unsigned char *p, buf[PBUFSIZ]; @@ -1020,14 +1017,15 @@ sds_insert_breakpoint (CORE_ADDR addr, char *contents_cache) retlen = sds_send (buf, p - buf); for (i = 0; i < 4; ++i) - contents_cache[i] = buf[i + 2]; + bp_tgt->shadow_contents[i] = buf[i + 2]; return 0; } static int -sds_remove_breakpoint (CORE_ADDR addr, char *contents_cache) +sds_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i, retlen; unsigned char *p, buf[PBUFSIZ]; @@ -1039,7 +1037,7 @@ sds_remove_breakpoint (CORE_ADDR addr, char *contents_cache) *p++ = (int) (addr >> 8) & 0xff; *p++ = (int) (addr) & 0xff; for (i = 0; i < 4; ++i) - *p++ = contents_cache[i]; + *p++ = bp_tgt->shadow_contents[i]; retlen = sds_send (buf, p - buf); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index e96018d..4e36f54 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -805,18 +805,6 @@ gdbsim_mourn_inferior (void) generic_mourn_inferior (); } -static int -gdbsim_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) -{ - return memory_insert_breakpoint (addr, contents_cache); -} - -static int -gdbsim_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) -{ - return memory_remove_breakpoint (addr, contents_cache); -} - /* Pass the command argument through to the simulator verbatim. The simulator must do any command interpretation work. */ @@ -866,8 +854,8 @@ init_gdbsim_ops (void) gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store; gdbsim_ops.deprecated_xfer_memory = gdbsim_xfer_inferior_memory; gdbsim_ops.to_files_info = gdbsim_files_info; - gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint; - gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint; + gdbsim_ops.to_insert_breakpoint = memory_insert_breakpoint; + gdbsim_ops.to_remove_breakpoint = memory_remove_breakpoint; gdbsim_ops.to_kill = gdbsim_kill; gdbsim_ops.to_load = gdbsim_load; gdbsim_ops.to_create_inferior = gdbsim_create_inferior; diff --git a/gdb/remote-st.c b/gdb/remote-st.c index c7c39a1..c2bcf3d 100644 --- a/gdb/remote-st.c +++ b/gdb/remote-st.c @@ -599,20 +599,16 @@ static CORE_ADDR breakaddr[MAX_STDEBUG_BREAKPOINTS] = {0}; static int -st2000_insert_breakpoint (CORE_ADDR addr, char *shadow) +st2000_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; - CORE_ADDR bp_addr = addr; - int bp_size = 0; - - BREAKPOINT_FROM_PC (&bp_addr, &bp_size); for (i = 0; i <= MAX_STDEBUG_BREAKPOINTS; i++) if (breakaddr[i] == 0) { breakaddr[i] = addr; - st2000_read_inferior_memory (bp_addr, shadow, bp_size); printf_stdebug ("BR %x H\r", addr); expect_prompt (1); return 0; @@ -623,8 +619,9 @@ st2000_insert_breakpoint (CORE_ADDR addr, char *shadow) } static int -st2000_remove_breakpoint (CORE_ADDR addr, char *shadow) +st2000_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; int i; for (i = 0; i < MAX_STDEBUG_BREAKPOINTS; i++) diff --git a/gdb/remote.c b/gdb/remote.c index 582a6bf..22581a5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -63,7 +63,7 @@ /* Prototypes for local functions. */ static void cleanup_sigint_signal_handler (void *dummy); static void initialize_sigint_signal_handler (void); -static int getpkt_sane (char *buf, long sizeof_buf, int forever); +static int getpkt_sane (char **buf, long *sizeof_buf, int forever); static void handle_remote_sigint (int); static void handle_remote_sigint_twice (int); @@ -104,7 +104,7 @@ static void extended_remote_mourn (void); static void remote_mourn_1 (struct target_ops *); -static void remote_send (char *buf, long sizeof_buf); +static void remote_send (char **buf, long *sizeof_buf_p); static int readchar (int timeout); @@ -132,11 +132,9 @@ static int remote_thread_alive (ptid_t); static void get_offsets (void); -static long read_frame (char *buf, long sizeof_buf); +static void skip_frame (void); -static int remote_insert_breakpoint (CORE_ADDR, bfd_byte *); - -static int remote_remove_breakpoint (CORE_ADDR, bfd_byte *); +static long read_frame (char **buf_p, long *sizeof_buf); static int hexnumlen (ULONGEST num); @@ -228,6 +226,15 @@ struct remote_state /* This is the maximum size (in chars) of a non read/write packet. It is also used as a cap on the size of read/write packets. */ long remote_packet_size; + + /* A buffer to use for incoming packets, and its current size. The + buffer is grown dynamically for larger incoming packets. + Outgoing packets may also be constructed in this buffer. + BUF_SIZE is always at least REMOTE_PACKET_SIZE; + REMOTE_PACKET_SIZE should be used to limit the length of outgoing + packets. */ + char *buf; + long buf_size; }; @@ -286,6 +293,14 @@ init_remote_state (struct gdbarch *gdbarch) /* This one is filled in when a ``g'' packet is received. */ rs->actual_register_packet_size = 0; + /* Create the buffer at a default size. Note that this would + leak memory if the gdbarch were ever destroyed; there's no + way to register a destructor for it, and we can't realloc + using the gdbarch obstack. But gdbarches are never + destroyed. */ + rs->buf_size = rs->remote_packet_size; + rs->buf = xmalloc (rs->buf_size); + return rs; } @@ -435,6 +450,15 @@ get_memory_packet_size (struct memory_packet_config *config) what_they_get = MAX_REMOTE_PACKET_SIZE; if (what_they_get < MIN_REMOTE_PACKET_SIZE) what_they_get = MIN_REMOTE_PACKET_SIZE; + + /* Make sure there is room in the global buffer for this packet + (including its trailing NUL byte). */ + if (rs->buf_size < what_they_get + 1) + { + rs->buf_size = 2 * what_they_get; + rs->buf = xrealloc (rs->buf, 2 * what_they_get); + } + return what_they_get; } @@ -884,7 +908,7 @@ static void set_thread (int th, int gen) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; int state = gen ? general_thread : continue_thread; if (state == th) @@ -902,7 +926,7 @@ set_thread (int th, int gen) else xsnprintf (&buf[2], rs->remote_packet_size - 2, "%x", th); putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (gen) general_thread = th; else @@ -914,15 +938,16 @@ set_thread (int th, int gen) static int remote_thread_alive (ptid_t ptid) { + struct remote_state *rs = get_remote_state (); int tid = PIDGET (ptid); - char buf[16]; + char *buf = rs->buf; if (tid < 0) - xsnprintf (buf, sizeof (buf), "T-%08x", -tid); + xsnprintf (buf, rs->remote_packet_size, "T-%08x", -tid); else - xsnprintf (buf, sizeof (buf), "T%08x", tid); + xsnprintf (buf, rs->remote_packet_size, "T%08x", tid); putpkt (buf); - getpkt (buf, sizeof (buf), 0); + getpkt (&rs->buf, &rs->buf_size, 0); return (buf[0] == 'O' && buf[1] == 'K'); } @@ -1331,7 +1356,7 @@ remote_unpack_thread_info_response (char *pkt, threadref *expectedref, int mask, length; int tag; threadref ref; - char *limit = pkt + rs->remote_packet_size; /* Plausible parsing limit. */ + char *limit = pkt + rs->buf_size; /* Plausible parsing limit. */ int retval = 1; /* info->threadid = 0; FIXME: implement zero_threadref. */ @@ -1422,11 +1447,11 @@ remote_get_threadinfo (threadref *threadid, int fieldset, /* TAG mask */ { struct remote_state *rs = get_remote_state (); int result; - char *threadinfo_pkt = alloca (rs->remote_packet_size); + char *threadinfo_pkt = rs->buf; pack_threadinfo_request (threadinfo_pkt, fieldset, threadid); putpkt (threadinfo_pkt); - getpkt (threadinfo_pkt, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); result = remote_unpack_thread_info_response (threadinfo_pkt + 2, threadid, info); return result; @@ -1460,7 +1485,7 @@ parse_threadlist_response (char *pkt, int result_limit, resultcount = 0; /* Assume the 'q' and 'M chars have been stripped. */ - limit = pkt + (rs->remote_packet_size - BUF_THREAD_ID_SIZE); + limit = pkt + (rs->buf_size - BUF_THREAD_ID_SIZE); /* done parse past here */ pkt = unpack_byte (pkt, &count); /* count field */ pkt = unpack_nibble (pkt, &done); @@ -1483,21 +1508,19 @@ remote_get_threadlist (int startflag, threadref *nextthread, int result_limit, { struct remote_state *rs = get_remote_state (); static threadref echo_nextthread; - char *threadlist_packet = alloca (rs->remote_packet_size); - char *t_response = alloca (rs->remote_packet_size); + char *threadlist_packet = rs->buf; int result = 1; /* Trancate result limit to be smaller than the packet size. */ if ((((result_limit + 1) * BUF_THREAD_ID_SIZE) + 10) >= rs->remote_packet_size) result_limit = (rs->remote_packet_size / BUF_THREAD_ID_SIZE) - 2; - pack_threadlist_request (threadlist_packet, - startflag, result_limit, nextthread); - putpkt (threadlist_packet); - getpkt (t_response, rs->remote_packet_size, 0); + pack_threadlist_request (rs->buf, startflag, result_limit, nextthread); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); *result_count = - parse_threadlist_response (t_response + 2, result_limit, &echo_nextthread, + parse_threadlist_response (rs->buf + 2, result_limit, &echo_nextthread, threadlist, done); if (!threadmatch (&echo_nextthread, nextthread)) @@ -1602,10 +1625,10 @@ static ptid_t remote_current_thread (ptid_t oldpid) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; putpkt ("qC"); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (buf[0] == 'Q' && buf[1] == 'C') /* Use strtoul here, so we'll correctly parse values whose highest bit is set. The protocol carries them as a simple series of @@ -1641,7 +1664,6 @@ static void remote_threads_info (void) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); char *bufp; int tid; @@ -1651,8 +1673,8 @@ remote_threads_info (void) if (use_threadinfo_query) { putpkt ("qfThreadInfo"); - bufp = buf; - getpkt (bufp, rs->remote_packet_size, 0); + bufp = rs->buf; + getpkt (&rs->buf, &rs->buf_size, 0); if (bufp[0] != '\0') /* q packet recognized */ { while (*bufp++ == 'm') /* reply contains one or more TID */ @@ -1671,8 +1693,8 @@ remote_threads_info (void) } while (*bufp++ == ','); /* comma-separated list */ putpkt ("qsThreadInfo"); - bufp = buf; - getpkt (bufp, rs->remote_packet_size, 0); + bufp = rs->buf; + getpkt (&rs->buf, &rs->buf_size, 0); } return; /* done */ } @@ -1702,7 +1724,6 @@ remote_threads_extra_info (struct thread_info *tp) threadref id; struct gdb_ext_thread_info threadinfo; static char display_buf[100]; /* arbitrary... */ - char *bufp = alloca (rs->remote_packet_size); int n = 0; /* position in display_buf */ if (remote_desc == 0) /* paranoia */ @@ -1711,10 +1732,12 @@ remote_threads_extra_info (struct thread_info *tp) if (use_threadextra_query) { + char *bufp = rs->buf; + xsnprintf (bufp, rs->remote_packet_size, "qThreadExtraInfo,%x", PIDGET (tp->ptid)); putpkt (bufp); - getpkt (bufp, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (bufp[0] != 0) { n = min (strlen (bufp) / 2, sizeof (display_buf)); @@ -1760,17 +1783,16 @@ static void extended_remote_restart (void) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); /* Send the restart command; for reasons I don't understand the remote side really expects a number after the "R". */ - xsnprintf (buf, rs->remote_packet_size, "R%x", 0); - putpkt (buf); + xsnprintf (rs->buf, rs->remote_packet_size, "R%x", 0); + putpkt (rs->buf); /* Now query for status so this looks just like we restarted gdbserver from scratch. */ putpkt ("?"); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); } /* Clean up connection to a remote debugger. */ @@ -1789,14 +1811,14 @@ static void get_offsets (void) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; char *ptr; int lose; CORE_ADDR text_addr, data_addr, bss_addr; struct section_offsets *offs; putpkt ("qOffsets"); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (buf[0] == '\000') return; /* Return silently. Stub doesn't support @@ -1955,14 +1977,17 @@ remote_check_symbols (struct objfile *objfile) if (remote_protocol_packets[PACKET_qSymbol].support == PACKET_DISABLE) return; - msg = alloca (rs->remote_packet_size); - reply = alloca (rs->remote_packet_size); + /* Allocate a message buffer. We can't reuse the input buffer in RS, + because we need both at the same time. */ + msg = alloca (rs->remote_packet_size); + + reply = rs->buf; /* Invite target to request symbol lookups. */ putpkt ("qSymbol::"); - getpkt (reply, rs->remote_packet_size, 0); - packet_ok (reply, &remote_protocol_packets[PACKET_qSymbol]); + getpkt (&rs->buf, &rs->buf_size, 0); + packet_ok (rs->buf, &remote_protocol_packets[PACKET_qSymbol]); while (strncmp (reply, "qSymbol:", 8) == 0) { @@ -1977,7 +2002,7 @@ remote_check_symbols (struct objfile *objfile) paddr_nz (SYMBOL_VALUE_ADDRESS (sym)), &reply[8]); putpkt (msg); - getpkt (reply, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); } } @@ -2123,9 +2148,8 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, if (extended_p) { /* Tell the remote that we are using the extended protocol. */ - char *buf = alloca (rs->remote_packet_size); putpkt ("!"); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); } post_create_inferior (¤t_target, from_tty); @@ -2143,14 +2167,13 @@ static void remote_detach (char *args, int from_tty) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); if (args) error (_("Argument given to \"detach\" when remotely debugging.")); /* Tell the remote target to detach. */ - strcpy (buf, "D"); - remote_send (buf, rs->remote_packet_size); + strcpy (rs->buf, "D"); + remote_send (&rs->buf, &rs->buf_size); /* Unregister the file descriptor from the event loop. */ if (target_is_async_p ()) @@ -2244,11 +2267,13 @@ bin2hex (const gdb_byte *bin, char *hex, int count) the response. */ static void -remote_vcont_probe (struct remote_state *rs, char *buf) +remote_vcont_probe (struct remote_state *rs) { + char *buf = rs->buf; + strcpy (buf, "vCont?"); putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); /* Make sure that the features we assume are supported. */ if (strncmp (buf, "vCont", 5) == 0) @@ -2302,17 +2327,11 @@ remote_vcont_resume (ptid_t ptid, int step, enum target_signal siggnal) char *buf = NULL, *outbuf; struct cleanup *old_cleanup; - buf = xmalloc (rs->remote_packet_size); - old_cleanup = make_cleanup (xfree, buf); - if (remote_protocol_packets[PACKET_vCont].support == PACKET_SUPPORT_UNKNOWN) - remote_vcont_probe (rs, buf); + remote_vcont_probe (rs); if (remote_protocol_packets[PACKET_vCont].support == PACKET_DISABLE) - { - do_cleanups (old_cleanup); - return 0; - } + return 0; /* If we could generate a wider range of packets, we'd have to worry about overflowing BUF. Should there be a generic @@ -2360,7 +2379,7 @@ remote_vcont_resume (ptid_t ptid, int step, enum target_signal siggnal) } gdb_assert (outbuf && strlen (outbuf) < rs->remote_packet_size); - make_cleanup (xfree, outbuf); + old_cleanup = make_cleanup (xfree, outbuf); putpkt (outbuf); @@ -2379,7 +2398,7 @@ static void remote_resume (ptid_t ptid, int step, enum target_signal siggnal) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; int pid = PIDGET (ptid); last_sent_signal = siggnal; @@ -2649,7 +2668,7 @@ static ptid_t remote_wait (ptid_t ptid, struct target_waitstatus *status) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; ULONGEST thread_num = -1; ULONGEST addr; @@ -2661,7 +2680,7 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status) char *p; ofunc = signal (SIGINT, remote_interrupt); - getpkt (buf, rs->remote_packet_size, 1); + getpkt (&rs->buf, &rs->buf_size, 1); signal (SIGINT, ofunc); /* This is a hook for when we need to do something (perhaps the @@ -2718,9 +2737,9 @@ remote_wait (ptid_t ptid, struct target_waitstatus *status) { p1 = strchr (p, ':'); if (p1 == NULL) - warning (_("Malformed packet(a) (missing colon): %s\n\ + error (_("Malformed packet(a) (missing colon): %s\n\ Packet: '%s'\n"), - p, buf); + p, buf); if (strncmp (p, "thread", p1 - p) == 0) { p_temp = unpack_varlen_hex (++p1, &thread_num); @@ -2838,7 +2857,7 @@ static ptid_t remote_async_wait (ptid_t ptid, struct target_waitstatus *status) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; ULONGEST thread_num = -1; ULONGEST addr; @@ -2857,7 +2876,7 @@ remote_async_wait (ptid_t ptid, struct target_waitstatus *status) _never_ wait for ever -> test on target_is_async_p(). However, before we do that we need to ensure that the caller knows how to take the target into/out of async mode. */ - getpkt (buf, rs->remote_packet_size, wait_forever_enabled_p); + getpkt (&rs->buf, &rs->buf_size, wait_forever_enabled_p); if (!target_is_async_p ()) signal (SIGINT, ofunc); @@ -3041,7 +3060,7 @@ static int fetch_register_using_p (int regnum) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size), *p; + char *buf = rs->buf, *p; char regp[MAX_REGISTER_SIZE]; int i; @@ -3049,7 +3068,7 @@ fetch_register_using_p (int regnum) *p++ = 'p'; p += hexnumstr (p, regnum); *p++ = '\0'; - remote_send (buf, rs->remote_packet_size); + remote_send (&rs->buf, &rs->buf_size); /* If the stub didn't recognize the packet, or if we got an error, tell our caller. */ @@ -3086,7 +3105,7 @@ static void remote_fetch_registers (int regnum) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; int i; char *p; char *regs = alloca (rs->sizeof_g_packet); @@ -3129,7 +3148,7 @@ remote_fetch_registers (int regnum) } sprintf (buf, "g"); - remote_send (buf, rs->remote_packet_size); + remote_send (&rs->buf, &rs->buf_size); /* Save the size of the packet sent to us by the target. Its used as a heuristic when determining the max size of packets that the @@ -3151,7 +3170,7 @@ remote_fetch_registers (int regnum) if (remote_debug) fprintf_unfiltered (gdb_stdlog, "Bad register packet; fetching a new packet\n"); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); } /* Reply describes registers byte by byte, each byte encoded as two @@ -3250,7 +3269,7 @@ store_register_using_P (int regnum) struct remote_state *rs = get_remote_state (); struct packet_reg *reg = packet_reg_from_regnum (rs, regnum); /* Try storing a single register. */ - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; gdb_byte regp[MAX_REGISTER_SIZE]; char *p; @@ -3258,7 +3277,7 @@ store_register_using_P (int regnum) p = buf + strlen (buf); regcache_raw_collect (current_regcache, reg->regnum, regp); bin2hex (regp, p, register_size (current_gdbarch, reg->regnum)); - remote_send (buf, rs->remote_packet_size); + remote_send (&rs->buf, &rs->buf_size); return buf[0] != '\0'; } @@ -3271,7 +3290,6 @@ static void remote_store_registers (int regnum) { struct remote_state *rs = get_remote_state (); - char *buf; gdb_byte *regs; char *p; @@ -3322,12 +3340,11 @@ remote_store_registers (int regnum) /* Command describes registers byte by byte, each byte encoded as two hex characters. */ - buf = alloca (rs->remote_packet_size); - p = buf; + p = rs->buf; *p++ = 'G'; /* remote_prepare_to_store insures that register_bytes_found gets set. */ bin2hex (regs, p, register_bytes_found); - remote_send (buf, rs->remote_packet_size); + remote_send (&rs->buf, &rs->buf_size); } @@ -3413,7 +3430,7 @@ check_binary_download (CORE_ADDR addr) break; case PACKET_SUPPORT_UNKNOWN: { - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; char *p; p = buf; @@ -3425,7 +3442,7 @@ check_binary_download (CORE_ADDR addr) *p = '\0'; putpkt_binary (buf, (int) (p - buf)); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (buf[0] == '\0') { @@ -3458,10 +3475,10 @@ check_binary_download (CORE_ADDR addr) int remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len) { + struct remote_state *rs = get_remote_state (); char *buf; char *p; char *plen; - long sizeof_buf; int plenlen; int todo; int nr_bytes; @@ -3473,10 +3490,9 @@ remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len) payload_size = get_memory_write_packet_size (); - /* Compute the size, and then allocate space for the largest - possible packet. Include space for an extra trailing NUL. */ - sizeof_buf = payload_size + 1; - buf = alloca (sizeof_buf); + /* The packet buffer will be large enough for the payload; + get_memory_packet_size ensures this. */ + buf = rs->buf; /* Compute the size of the actual payload by subtracting out the packet header and footer overhead: "$M,:...#nn". @@ -3583,7 +3599,7 @@ remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len) } putpkt_binary (buf, (int) (p - buf)); - getpkt (buf, sizeof_buf, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (buf[0] == 'E') { @@ -3618,15 +3634,15 @@ remote_write_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len) int remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len) { + struct remote_state *rs = get_remote_state (); char *buf; int max_buf_size; /* Max size of packet output buffer. */ - long sizeof_buf; int origlen; - /* Create a buffer big enough for this packet. */ max_buf_size = get_memory_read_packet_size (); - sizeof_buf = max_buf_size + 1; /* Space for trailing NULL. */ - buf = alloca (sizeof_buf); + /* The packet buffer will be large enough for the payload; + get_memory_packet_size ensures this. */ + buf = rs->buf; origlen = len; while (len > 0) @@ -3648,7 +3664,7 @@ remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr, int len) *p = '\0'; putpkt (buf); - getpkt (buf, sizeof_buf, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (buf[0] == 'E' && isxdigit (buf[1]) && isxdigit (buf[2]) @@ -3747,18 +3763,20 @@ readchar (int timeout) return ch; } -/* Send the command in BUF to the remote machine, and read the reply - into BUF. Report an error if we get an error reply. */ +/* Send the command in *BUF to the remote machine, and read the reply + into *BUF. Report an error if we get an error reply. Resize + *BUF using xrealloc if necessary to hold the result, and update + *SIZEOF_BUF. */ static void -remote_send (char *buf, - long sizeof_buf) +remote_send (char **buf, + long *sizeof_buf) { - putpkt (buf); + putpkt (*buf); getpkt (buf, sizeof_buf, 0); - if (buf[0] == 'E') - error (_("Remote failure reply: %s"), buf); + if ((*buf)[0] == 'E') + error (_("Remote failure reply: %s"), *buf); } /* Display a null-terminated packet on stdout, for debugging, using C @@ -3791,8 +3809,6 @@ putpkt_binary (char *buf, int cnt) int i; unsigned char csum = 0; char *buf2 = alloca (cnt + 6); - long sizeof_junkbuf = rs->remote_packet_size; - char *junkbuf = alloca (sizeof_junkbuf); int ch; int tcount = 0; @@ -3874,7 +3890,7 @@ putpkt_binary (char *buf, int cnt) was lost. Gobble up the packet and ack it so it doesn't get retransmitted when we resend this packet. */ - read_frame (junkbuf, sizeof_junkbuf); + skip_frame (); serial_write (remote_desc, "+", 1); continue; /* Now, go look for +. */ } @@ -3908,29 +3924,65 @@ putpkt_binary (char *buf, int cnt) } } +/* Come here after finding the start of a frame when we expected an + ack. Do our best to discard the rest of this packet. */ + +static void +skip_frame (void) +{ + int c; + + while (1) + { + c = readchar (remote_timeout); + switch (c) + { + case SERIAL_TIMEOUT: + /* Nothing we can do. */ + return; + case '#': + /* Discard the two bytes of checksum and stop. */ + c = readchar (remote_timeout); + if (c >= 0) + c = readchar (remote_timeout); + + return; + case '*': /* Run length encoding. */ + /* Discard the repeat count. */ + c = readchar (remote_timeout); + if (c < 0) + return; + break; + default: + /* A regular character. */ + break; + } + } +} + /* Come here after finding the start of the frame. Collect the rest - into BUF, verifying the checksum, length, and handling run-length - compression. No more than sizeof_buf-1 characters are read so that - the buffer can be NUL terminated. + into *BUF, verifying the checksum, length, and handling run-length + compression. NUL terminate the buffer. If there is not enough room, + expand *BUF using xrealloc. Returns -1 on error, number of characters in buffer (ignoring the trailing NULL) on success. (could be extended to return one of the SERIAL status indications). */ static long -read_frame (char *buf, - long sizeof_buf) +read_frame (char **buf_p, + long *sizeof_buf) { unsigned char csum; long bc; int c; + char *buf = *buf_p; csum = 0; bc = 0; while (1) { - /* ASSERT (bc < sizeof_buf - 1) - space for trailing NULL. */ c = readchar (remote_timeout); switch (c) { @@ -3997,51 +4049,53 @@ read_frame (char *buf, /* The character before ``*'' is repeated. */ - if (repeat > 0 && repeat <= 255 - && bc > 0 - && bc + repeat - 1 < sizeof_buf - 1) + if (repeat > 0 && repeat <= 255 && bc > 0) { + if (bc + repeat - 1 >= *sizeof_buf - 1) + { + /* Make some more room in the buffer. */ + *sizeof_buf += repeat; + *buf_p = xrealloc (*buf_p, *sizeof_buf); + buf = *buf_p; + } + memset (&buf[bc], buf[bc - 1], repeat); bc += repeat; continue; } buf[bc] = '\0'; - printf_filtered (_("Repeat count %d too large for buffer: "), - repeat); - puts_filtered (buf); - puts_filtered ("\n"); + printf_filtered (_("Invalid run length encoding: %s\n"), buf); return -1; } default: - if (bc < sizeof_buf - 1) + if (bc >= *sizeof_buf - 1) { - buf[bc++] = c; - csum += c; - continue; + /* Make some more room in the buffer. */ + *sizeof_buf *= 2; + *buf_p = xrealloc (*buf_p, *sizeof_buf); + buf = *buf_p; } - buf[bc] = '\0'; - puts_filtered ("Remote packet too long: "); - puts_filtered (buf); - puts_filtered ("\n"); - - return -1; + buf[bc++] = c; + csum += c; + continue; } } } /* Read a packet from the remote machine, with error checking, and - store it in BUF. If FOREVER, wait forever rather than timing out; - this is used (in synchronous mode) to wait for a target that is is - executing user code to stop. */ + store it in *BUF. Resize *BUF using xrealloc if necessary to hold + the result, and update *SIZEOF_BUF. If FOREVER, wait forever + rather than timing out; this is used (in synchronous mode) to wait + for a target that is is executing user code to stop. */ /* FIXME: ezannoni 2000-02-01 this wrapper is necessary so that we don't have to change all the calls to getpkt to deal with the return value, because at the moment I don't know what the right thing to do it for those. */ void -getpkt (char *buf, - long sizeof_buf, +getpkt (char **buf, + long *sizeof_buf, int forever) { int timed_out; @@ -4051,22 +4105,21 @@ getpkt (char *buf, /* Read a packet from the remote machine, with error checking, and - store it in BUF. If FOREVER, wait forever rather than timing out; - this is used (in synchronous mode) to wait for a target that is is - executing user code to stop. If FOREVER == 0, this function is - allowed to time out gracefully and return an indication of this to - the caller. */ + store it in *BUF. Resize *BUF using xrealloc if necessary to hold + the result, and update *SIZEOF_BUF. If FOREVER, wait forever + rather than timing out; this is used (in synchronous mode) to wait + for a target that is is executing user code to stop. If FOREVER == + 0, this function is allowed to time out gracefully and return an + indication of this to the caller. */ static int -getpkt_sane (char *buf, - long sizeof_buf, - int forever) +getpkt_sane (char **buf, long *sizeof_buf, int forever) { int c; int tries; int timeout; int val; - strcpy (buf, "timeout"); + strcpy (*buf, "timeout"); if (forever) { @@ -4118,7 +4171,7 @@ getpkt_sane (char *buf, if (remote_debug) { fprintf_unfiltered (gdb_stdlog, "Packet received: "); - fputstr_unfiltered (buf, 0, gdb_stdlog); + fputstr_unfiltered (*buf, 0, gdb_stdlog); fprintf_unfiltered (gdb_stdlog, "\n"); } serial_write (remote_desc, "+", 1); @@ -4299,22 +4352,18 @@ static unsigned char little_break_insn[] = DEPRECATED_LITTLE_REMOTE_BREAKPOINT; #endif /* DEPRECATED_REMOTE_BREAKPOINT */ -/* Insert a breakpoint on targets that don't have any better - breakpoint support. We read the contents of the target location - and stash it, then overwrite it with a breakpoint instruction. - ADDR is the target location in the target machine. CONTENTS_CACHE - is a pointer to memory allocated for saving the target contents. - It is guaranteed by the caller to be long enough to save the number - of bytes returned by BREAKPOINT_FROM_PC. */ +/* Insert a breakpoint. On targets that have software breakpoint + support, we ask the remote target to do the work; on targets + which don't, we insert a traditional memory breakpoint. */ static int -remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +remote_insert_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; struct remote_state *rs = get_remote_state (); #ifdef DEPRECATED_REMOTE_BREAKPOINT int val; #endif - int bp_size; /* Try the "Z" s/w breakpoint packet if it is not already disabled. If it succeeds, then set the support to PACKET_ENABLE. If it @@ -4323,21 +4372,20 @@ remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE) { - char *buf = alloca (rs->remote_packet_size); - char *p = buf; + char *p = rs->buf; - addr = remote_address_masked (addr); *(p++) = 'Z'; *(p++) = '0'; *(p++) = ','; - p += hexnumstr (p, (ULONGEST) addr); - BREAKPOINT_FROM_PC (&addr, &bp_size); - sprintf (p, ",%d", bp_size); + BREAKPOINT_FROM_PC (&bp_tgt->placed_address, &bp_tgt->placed_size); + addr = (ULONGEST) remote_address_masked (bp_tgt->placed_address); + p += hexnumstr (p, addr); + sprintf (p, ",%d", bp_tgt->placed_size); - putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); - switch (packet_ok (buf, &remote_protocol_packets[PACKET_Z0])) + switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z0])) { case PACKET_ERROR: return -1; @@ -4349,7 +4397,8 @@ remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) } #ifdef DEPRECATED_REMOTE_BREAKPOINT - val = target_read_memory (addr, contents_cache, sizeof big_break_insn); + bp_tgt->placed_size = bp_tgt->shadow_len = sizeof big_break_insn; + val = target_read_memory (addr, bp_tgt->shadow_contents, bp_tgt->shadow_len); if (val == 0) { @@ -4363,40 +4412,40 @@ remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) return val; #else - return memory_insert_breakpoint (addr, contents_cache); + return memory_insert_breakpoint (bp_tgt); #endif /* DEPRECATED_REMOTE_BREAKPOINT */ } static int -remote_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache) +remote_remove_breakpoint (struct bp_target_info *bp_tgt) { + CORE_ADDR addr = bp_tgt->placed_address; struct remote_state *rs = get_remote_state (); int bp_size; if (remote_protocol_packets[PACKET_Z0].support != PACKET_DISABLE) { - char *buf = alloca (rs->remote_packet_size); - char *p = buf; + char *p = rs->buf; *(p++) = 'z'; *(p++) = '0'; *(p++) = ','; - addr = remote_address_masked (addr); - p += hexnumstr (p, (ULONGEST) addr); - BREAKPOINT_FROM_PC (&addr, &bp_size); - sprintf (p, ",%d", bp_size); + addr = (ULONGEST) remote_address_masked (bp_tgt->placed_address); + p += hexnumstr (p, addr); + sprintf (p, ",%d", bp_tgt->placed_size); - putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); - return (buf[0] == 'E'); + return (rs->buf[0] == 'E'); } #ifdef DEPRECATED_REMOTE_BREAKPOINT - return target_write_memory (addr, contents_cache, sizeof big_break_insn); + return target_write_memory (bp_tgt->placed_address, bp_tgt->shadow_contents, + bp_tgt->shadow_len); #else - return memory_remove_breakpoint (addr, contents_cache); + return memory_remove_breakpoint (bp_tgt); #endif /* DEPRECATED_REMOTE_BREAKPOINT */ } @@ -4406,13 +4455,13 @@ watchpoint_to_Z_packet (int type) switch (type) { case hw_write: - return 2; + return Z_PACKET_WRITE_WP; break; case hw_read: - return 3; + return Z_PACKET_READ_WP; break; case hw_access: - return 4; + return Z_PACKET_ACCESS_WP; break; default: internal_error (__FILE__, __LINE__, @@ -4424,7 +4473,6 @@ static int remote_insert_watchpoint (CORE_ADDR addr, int len, int type) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); char *p; enum Z_packet_type packet = watchpoint_to_Z_packet (type); @@ -4433,16 +4481,16 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type) remote_protocol_packets[PACKET_Z0 + packet].name, remote_protocol_packets[PACKET_Z0 + packet].title); - sprintf (buf, "Z%x,", packet); - p = strchr (buf, '\0'); + sprintf (rs->buf, "Z%x,", packet); + p = strchr (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); sprintf (p, ",%x", len); - putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); - switch (packet_ok (buf, &remote_protocol_packets[PACKET_Z0 + packet])) + switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z0 + packet])) { case PACKET_ERROR: case PACKET_UNKNOWN: @@ -4459,7 +4507,6 @@ static int remote_remove_watchpoint (CORE_ADDR addr, int len, int type) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); char *p; enum Z_packet_type packet = watchpoint_to_Z_packet (type); @@ -4468,15 +4515,15 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type) remote_protocol_packets[PACKET_Z0 + packet].name, remote_protocol_packets[PACKET_Z0 + packet].title); - sprintf (buf, "z%x,", packet); - p = strchr (buf, '\0'); + sprintf (rs->buf, "z%x,", packet); + p = strchr (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); sprintf (p, ",%x", len); - putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); - switch (packet_ok (buf, &remote_protocol_packets[PACKET_Z0 + packet])) + switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z0 + packet])) { case PACKET_ERROR: case PACKET_UNKNOWN: @@ -4542,17 +4589,16 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) static int -remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow) +remote_insert_hw_breakpoint (struct bp_target_info *bp_tgt) { - int len = 0; + CORE_ADDR addr; struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); - char *p = buf; + char *p = rs->buf; /* The length field should be set to the size of a breakpoint - instruction. */ + instruction, even though we aren't inserting one ourselves. */ - BREAKPOINT_FROM_PC (&addr, &len); + BREAKPOINT_FROM_PC (&bp_tgt->placed_address, &bp_tgt->placed_size); if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) error (_("Can't set hardware breakpoint without the '%s' (%s) packet."), @@ -4563,14 +4609,14 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow) *(p++) = '1'; *(p++) = ','; - addr = remote_address_masked (addr); + addr = remote_address_masked (bp_tgt->placed_address); p += hexnumstr (p, (ULONGEST) addr); - sprintf (p, ",%x", len); + sprintf (p, ",%x", bp_tgt->placed_size); - putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); - switch (packet_ok (buf, &remote_protocol_packets[PACKET_Z1])) + switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z1])) { case PACKET_ERROR: case PACKET_UNKNOWN: @@ -4584,17 +4630,11 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow) static int -remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow) +remote_remove_hw_breakpoint (struct bp_target_info *bp_tgt) { - int len; + CORE_ADDR addr; struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); - char *p = buf; - - /* The length field should be set to the size of a breakpoint - instruction. */ - - BREAKPOINT_FROM_PC (&addr, &len); + char *p = rs->buf; if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) error (_("Can't clear hardware breakpoint without the '%s' (%s) packet."), @@ -4605,14 +4645,14 @@ remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow) *(p++) = '1'; *(p++) = ','; - addr = remote_address_masked (addr); + addr = remote_address_masked (bp_tgt->placed_address); p += hexnumstr (p, (ULONGEST) addr); - sprintf (p, ",%x", len); + sprintf (p, ",%x", bp_tgt->placed_size); - putpkt(buf); - getpkt (buf, rs->remote_packet_size, 0); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); - switch (packet_ok (buf, &remote_protocol_packets[PACKET_Z1])) + switch (packet_ok (rs->buf, &remote_protocol_packets[PACKET_Z1])) { case PACKET_ERROR: case PACKET_UNKNOWN: @@ -4694,7 +4734,6 @@ compare_sections_command (char *args, int from_tty) char *tmp; char *sectdata; const char *sectname; - char *buf = alloca (rs->remote_packet_size); bfd_size_type size; bfd_vma lma; int matched = 0; @@ -4722,9 +4761,9 @@ compare_sections_command (char *args, int from_tty) matched = 1; /* do this section */ lma = s->lma; /* FIXME: assumes lma can fit into long. */ - xsnprintf (buf, rs->remote_packet_size, "qCRC:%lx,%lx", + xsnprintf (rs->buf, rs->remote_packet_size, "qCRC:%lx,%lx", (long) lma, (long) size); - putpkt (buf); + putpkt (rs->buf); /* Be clever; compute the host_crc before waiting for target reply. */ @@ -4733,14 +4772,14 @@ compare_sections_command (char *args, int from_tty) bfd_get_section_contents (exec_bfd, s, sectdata, 0, size); host_crc = crc32 ((unsigned char *) sectdata, size, 0xffffffff); - getpkt (buf, rs->remote_packet_size, 0); - if (buf[0] == 'E') + getpkt (&rs->buf, &rs->buf_size, 0); + if (rs->buf[0] == 'E') error (_("target memory fault, section %s, range 0x%s -- 0x%s"), sectname, paddr (lma), paddr (lma + size)); - if (buf[0] != 'C') + if (rs->buf[0] != 'C') error (_("remote target does not support this operation")); - for (target_crc = 0, tmp = &buf[1]; *tmp; tmp++) + for (target_crc = 0, tmp = &rs->buf[1]; *tmp; tmp++) target_crc = target_crc * 16 + fromhex (*tmp); printf_filtered ("Section %s, range 0x%s -- 0x%s: ", @@ -4769,8 +4808,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object, { struct remote_state *rs = get_remote_state (); int i; - char *buf2 = alloca (rs->remote_packet_size); - char *p2 = &buf2[0]; + char *p2; char query_type; /* Handle memory using remote_xfer_memory. */ @@ -4820,22 +4858,22 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object, while (len > 0) { LONGEST n = min ((rs->remote_packet_size - 2) / 2, len); - snprintf (buf2, rs->remote_packet_size, + snprintf (rs->buf, rs->remote_packet_size, "qPart:auxv:read::%s,%s", phex_nz (offset, sizeof offset), phex_nz (n, sizeof n)); - i = putpkt (buf2); + i = putpkt (rs->buf); if (i < 0) return total > 0 ? total : i; - buf2[0] = '\0'; - getpkt (buf2, rs->remote_packet_size, 0); - if (packet_ok (buf2, &remote_protocol_packets[PACKET_qPart_auxv]) + rs->buf[0] = '\0'; + getpkt (&rs->buf, &rs->buf_size, 0); + if (packet_ok (rs->buf, &remote_protocol_packets[PACKET_qPart_auxv]) != PACKET_OK) return total > 0 ? total : -1; - if (buf2[0] == 'O' && buf2[1] == 'K' && buf2[2] == '\0') + if (strcmp (rs->buf, "OK") == 0) break; /* Got EOF indicator. */ /* Got some data. */ - i = hex2bin (buf2, readbuf, len); + i = hex2bin (rs->buf, readbuf, len); if (i > 0) { readbuf = (void *) ((char *) readbuf + i); @@ -4869,6 +4907,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object, gdb_assert (annex != NULL); gdb_assert (readbuf != NULL); + p2 = rs->buf; *p2++ = 'q'; *p2++ = query_type; @@ -4888,11 +4927,12 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object, *p2 = '\0'; gdb_assert (annex[i] == '\0'); - i = putpkt (buf2); + i = putpkt (rs->buf); if (i < 0) return i; - getpkt ((char *) readbuf, len, 0); + getpkt (&rs->buf, &rs->buf_size, 0); + strcpy ((char *) readbuf, rs->buf); return strlen ((char *) readbuf); } @@ -4902,7 +4942,7 @@ remote_rcmd (char *command, struct ui_file *outbuf) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); + char *buf = rs->buf; char *p = buf; if (!remote_desc) @@ -4922,7 +4962,7 @@ remote_rcmd (char *command, /* Encode the actual command. */ bin2hex ((gdb_byte *) command, p, 0); - if (putpkt (buf) < 0) + if (putpkt (rs->buf) < 0) error (_("Communication problem with target.")); /* get/display the response */ @@ -4930,7 +4970,7 @@ remote_rcmd (char *command, { /* XXX - see also tracepoint.c:remote_get_noisy_reply(). */ buf[0] = '\0'; - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); if (buf[0] == '\0') error (_("Target does not support this command.")); if (buf[0] == 'O' && buf[1] != 'K') @@ -4958,7 +4998,6 @@ static void packet_command (char *args, int from_tty) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); if (!remote_desc) error (_("command can only be used with remote target")); @@ -4971,9 +5010,9 @@ packet_command (char *args, int from_tty) puts_filtered ("\n"); putpkt (args); - getpkt (buf, rs->remote_packet_size, 0); + getpkt (&rs->buf, &rs->buf_size, 0); puts_filtered ("received: "); - print_packet (buf); + print_packet (rs->buf); puts_filtered ("\n"); } @@ -5143,8 +5182,7 @@ remote_get_thread_local_address (ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset) if (remote_protocol_packets[PACKET_qGetTLSAddr].support != PACKET_DISABLE) { struct remote_state *rs = get_remote_state (); - char *buf = alloca (rs->remote_packet_size); - char *p = buf; + char *p = rs->buf; enum packet_result result; strcpy (p, "qGetTLSAddr:"); @@ -5156,14 +5194,14 @@ remote_get_thread_local_address (ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset) p += hexnumstr (p, lm); *p++ = '\0'; - putpkt (buf); - getpkt (buf, rs->remote_packet_size, 0); - result = packet_ok (buf, &remote_protocol_packets[PACKET_qGetTLSAddr]); + putpkt (rs->buf); + getpkt (&rs->buf, &rs->buf_size, 0); + result = packet_ok (rs->buf, &remote_protocol_packets[PACKET_qGetTLSAddr]); if (result == PACKET_OK) { ULONGEST result; - unpack_varlen_hex (buf, &result); + unpack_varlen_hex (rs->buf, &result); return result; } else if (result == PACKET_UNKNOWN) diff --git a/gdb/remote.h b/gdb/remote.h index ee34f63..c715e58 100644 --- a/gdb/remote.h +++ b/gdb/remote.h @@ -24,11 +24,12 @@ /* FIXME?: move this interface down to tgt vector) */ /* Read a packet from the remote machine, with error checking, and - store it in BUF. BUF is expected to be of size PBUFSIZ. If - FOREVER, wait forever rather than timing out; this is used while - the target is executing user code. */ + store it in *BUF. Resize *BUF using xrealloc if necessary to hold + the result, and update *SIZEOF_BUF. If FOREVER, wait forever + rather than timing out; this is used (in synchronous mode) to wait + for a target that is is executing user code to stop. */ -extern void getpkt (char *buf, long sizeof_buf, int forever); +extern void getpkt (char **buf, long *sizeof_buf, int forever); /* Send a packet to the remote machine, with error checking. The data of the packet is in BUF. The string in BUF can be at most PBUFSIZ diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index 4b2dc65..705016c 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -527,15 +527,15 @@ exec_one_dummy_insn (void) { #define DUMMY_INSN_ADDR (TEXT_SEGMENT_BASE)+0x200 - char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */ int ret, status, pid; CORE_ADDR prev_pc; + void *bp; /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We assume that this address will never be executed again by the real code. */ - target_insert_breakpoint (DUMMY_INSN_ADDR, shadow_contents); + bp = deprecated_insert_raw_breakpoint (DUMMY_INSN_ADDR); /* You might think this could be done with a single ptrace call, and you'd be correct for just about every platform I've ever worked @@ -559,7 +559,7 @@ exec_one_dummy_insn (void) while (pid != PIDGET (inferior_ptid)); write_pc (prev_pc); - target_remove_breakpoint (DUMMY_INSN_ADDR, shadow_contents); + deprecated_remove_raw_breakpoint (bp); } /* Fetch registers from the register section in core bfd. */ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index f782800..f932b4c 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -110,17 +110,6 @@ struct reg register number. */ }; -/* Breakpoint shadows for the single step instructions will be kept here. */ - -static struct sstep_breaks -{ - /* Address, or 0 if this is not in use. */ - CORE_ADDR address; - /* Shadow contents. */ - gdb_byte data[4]; -} -stepBreaks[2]; - /* Hook for determining the TOC address when calling functions in the inferior under AIX. The initialization code in rs6000-nat.c sets this hook to point to find_toc_address. */ @@ -730,7 +719,6 @@ rs6000_software_single_step (enum target_signal signal, if (insert_breakpoints_p) { - loc = read_pc (); insn = read_memory_integer (loc, 4); @@ -743,28 +731,17 @@ rs6000_software_single_step (enum target_signal signal, if (breaks[1] == breaks[0]) breaks[1] = -1; - stepBreaks[1].address = 0; - for (ii = 0; ii < 2; ++ii) { - /* ignore invalid breakpoint. */ if (breaks[ii] == -1) continue; - target_insert_breakpoint (breaks[ii], stepBreaks[ii].data); - stepBreaks[ii].address = breaks[ii]; + insert_single_step_breakpoint (breaks[ii]); } - } else - { + remove_single_step_breakpoints (); - /* remove step breakpoints. */ - for (ii = 0; ii < 2; ++ii) - if (stepBreaks[ii].address != 0) - target_remove_breakpoint (stepBreaks[ii].address, - stepBreaks[ii].data); - } errno = 0; /* FIXME, don't ignore errors! */ /* What errors? {read,write}_memory call error(). */ } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index dddef7a..4018ad1 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -44,6 +44,7 @@ #include "gdb_assert.h" #include "dis-asm.h" #include "solib-svr4.h" +#include "prologue-value.h" #include "s390-tdep.h" @@ -476,330 +477,6 @@ s390_regset_from_core_section (struct gdbarch *gdbarch, } -/* Prologue analysis. */ - -/* When we analyze a prologue, we're really doing 'abstract - interpretation' or 'pseudo-evaluation': running the function's code - in simulation, but using conservative approximations of the values - it would have when it actually runs. For example, if our function - starts with the instruction: - - ahi r1, 42 # add halfword immediate 42 to r1 - - we don't know exactly what value will be in r1 after executing this - instruction, but we do know it'll be 42 greater than its original - value. - - If we then see an instruction like: - - ahi r1, 22 # add halfword immediate 22 to r1 - - we still don't know what r1's value is, but again, we can say it is - now 64 greater than its original value. - - If the next instruction were: - - lr r2, r1 # set r2 to r1's value - - then we can say that r2's value is now the original value of r1 - plus 64. And so on. - - Of course, this can only go so far before it gets unreasonable. If - we wanted to be able to say anything about the value of r1 after - the instruction: - - xr r1, r3 # exclusive-or r1 and r3, place result in r1 - - then things would get pretty complex. But remember, we're just - doing a conservative approximation; if exclusive-or instructions - aren't relevant to prologues, we can just say r1's value is now - 'unknown'. We can ignore things that are too complex, if that loss - of information is acceptable for our application. - - Once you've reached an instruction that you don't know how to - simulate, you stop. Now you examine the state of the registers and - stack slots you've kept track of. For example: - - - To see how large your stack frame is, just check the value of sp; - if it's the original value of sp minus a constant, then that - constant is the stack frame's size. If the sp's value has been - marked as 'unknown', then that means the prologue has done - something too complex for us to track, and we don't know the - frame size. - - - To see whether we've saved the SP in the current frame's back - chain slot, we just check whether the current value of the back - chain stack slot is the original value of the sp. - - Sure, this takes some work. But prologue analyzers aren't - quick-and-simple pattern patching to recognize a few fixed prologue - forms any more; they're big, hairy functions. Along with inferior - function calls, prologue analysis accounts for a substantial - portion of the time needed to stabilize a GDB port. So I think - it's worthwhile to look for an approach that will be easier to - understand and maintain. In the approach used here: - - - It's easier to see that the analyzer is correct: you just see - whether the analyzer properly (albiet conservatively) simulates - the effect of each instruction. - - - It's easier to extend the analyzer: you can add support for new - instructions, and know that you haven't broken anything that - wasn't already broken before. - - - It's orthogonal: to gather new information, you don't need to - complicate the code for each instruction. As long as your domain - of conservative values is already detailed enough to tell you - what you need, then all the existing instruction simulations are - already gathering the right data for you. - - A 'struct prologue_value' is a conservative approximation of the - real value the register or stack slot will have. */ - -struct prologue_value { - - /* What sort of value is this? This determines the interpretation - of subsequent fields. */ - enum { - - /* We don't know anything about the value. This is also used for - values we could have kept track of, when doing so would have - been too complex and we don't want to bother. The bottom of - our lattice. */ - pv_unknown, - - /* A known constant. K is its value. */ - pv_constant, - - /* The value that register REG originally had *UPON ENTRY TO THE - FUNCTION*, plus K. If K is zero, this means, obviously, just - the value REG had upon entry to the function. REG is a GDB - register number. Before we start interpreting, we initialize - every register R to { pv_register, R, 0 }. */ - pv_register, - - } kind; - - /* The meanings of the following fields depend on 'kind'; see the - comments for the specific 'kind' values. */ - int reg; - CORE_ADDR k; -}; - - -/* Set V to be unknown. */ -static void -pv_set_to_unknown (struct prologue_value *v) -{ - v->kind = pv_unknown; -} - - -/* Set V to the constant K. */ -static void -pv_set_to_constant (struct prologue_value *v, CORE_ADDR k) -{ - v->kind = pv_constant; - v->k = k; -} - - -/* Set V to the original value of register REG, plus K. */ -static void -pv_set_to_register (struct prologue_value *v, int reg, CORE_ADDR k) -{ - v->kind = pv_register; - v->reg = reg; - v->k = k; -} - - -/* If one of *A and *B is a constant, and the other isn't, swap the - pointers as necessary to ensure that *B points to the constant. - This can reduce the number of cases we need to analyze in the - functions below. */ -static void -pv_constant_last (struct prologue_value **a, - struct prologue_value **b) -{ - if ((*a)->kind == pv_constant - && (*b)->kind != pv_constant) - { - struct prologue_value *temp = *a; - *a = *b; - *b = temp; - } -} - - -/* Set SUM to the sum of A and B. SUM, A, and B may point to the same - 'struct prologue_value' object. */ -static void -pv_add (struct prologue_value *sum, - struct prologue_value *a, - struct prologue_value *b) -{ - pv_constant_last (&a, &b); - - /* We can handle adding constants to registers, and other constants. */ - if (b->kind == pv_constant - && (a->kind == pv_register - || a->kind == pv_constant)) - { - sum->kind = a->kind; - sum->reg = a->reg; /* not meaningful if a is pv_constant, but - harmless */ - sum->k = a->k + b->k; - } - - /* Anything else we don't know how to add. We don't have a - representation for, say, the sum of two registers, or a multiple - of a register's value (adding a register to itself). */ - else - sum->kind = pv_unknown; -} - - -/* Add the constant K to V. */ -static void -pv_add_constant (struct prologue_value *v, CORE_ADDR k) -{ - struct prologue_value pv_k; - - /* Rather than thinking of all the cases we can and can't handle, - we'll just let pv_add take care of that for us. */ - pv_set_to_constant (&pv_k, k); - pv_add (v, v, &pv_k); -} - - -/* Subtract B from A, and put the result in DIFF. - - This isn't quite the same as negating B and adding it to A, since - we don't have a representation for the negation of anything but a - constant. For example, we can't negate { pv_register, R1, 10 }, - but we do know that { pv_register, R1, 10 } minus { pv_register, - R1, 5 } is { pv_constant, , 5 }. - - This means, for example, that we can subtract two stack addresses; - they're both relative to the original SP. Since the frame pointer - is set based on the SP, its value will be the original SP plus some - constant (probably zero), so we can use its value just fine. */ -static void -pv_subtract (struct prologue_value *diff, - struct prologue_value *a, - struct prologue_value *b) -{ - pv_constant_last (&a, &b); - - /* We can subtract a constant from another constant, or from a - register. */ - if (b->kind == pv_constant - && (a->kind == pv_register - || a->kind == pv_constant)) - { - diff->kind = a->kind; - diff->reg = a->reg; /* not always meaningful, but harmless */ - diff->k = a->k - b->k; - } - - /* We can subtract a register from itself, yielding a constant. */ - else if (a->kind == pv_register - && b->kind == pv_register - && a->reg == b->reg) - { - diff->kind = pv_constant; - diff->k = a->k - b->k; - } - - /* We don't know how to subtract anything else. */ - else - diff->kind = pv_unknown; -} - - -/* Set AND to the logical and of A and B. */ -static void -pv_logical_and (struct prologue_value *and, - struct prologue_value *a, - struct prologue_value *b) -{ - pv_constant_last (&a, &b); - - /* We can 'and' two constants. */ - if (a->kind == pv_constant - && b->kind == pv_constant) - { - and->kind = pv_constant; - and->k = a->k & b->k; - } - - /* We can 'and' anything with the constant zero. */ - else if (b->kind == pv_constant - && b->k == 0) - { - and->kind = pv_constant; - and->k = 0; - } - - /* We can 'and' anything with ~0. */ - else if (b->kind == pv_constant - && b->k == ~ (CORE_ADDR) 0) - *and = *a; - - /* We can 'and' a register with itself. */ - else if (a->kind == pv_register - && b->kind == pv_register - && a->reg == b->reg - && a->k == b->k) - *and = *a; - - /* Otherwise, we don't know. */ - else - pv_set_to_unknown (and); -} - - -/* Return non-zero iff A and B are identical expressions. - - This is not the same as asking if the two values are equal; the - result of such a comparison would have to be a pv_boolean, and - asking whether two 'unknown' values were equal would give you - pv_maybe. Same for comparing, say, { pv_register, R1, 0 } and { - pv_register, R2, 0}. Instead, this is asking whether the two - representations are the same. */ -static int -pv_is_identical (struct prologue_value *a, - struct prologue_value *b) -{ - if (a->kind != b->kind) - return 0; - - switch (a->kind) - { - case pv_unknown: - return 1; - case pv_constant: - return (a->k == b->k); - case pv_register: - return (a->reg == b->reg && a->k == b->k); - default: - gdb_assert (0); - } -} - - -/* Return non-zero if A is the original value of register number R - plus K, zero otherwise. */ -static int -pv_is_register (struct prologue_value *a, int r, CORE_ADDR k) -{ - return (a->kind == pv_register - && a->reg == r - && a->k == k); -} - - /* Decoding S/390 instructions. */ /* Named opcode values for the S/390 instructions we recognize. Some @@ -1032,50 +709,25 @@ is_rxy (bfd_byte *insn, int op1, int op2, } -/* Set ADDR to the effective address for an X-style instruction, like: - - L R1, D2(X2, B2) - - Here, X2 and B2 are registers, and D2 is a signed 20-bit - constant; the effective address is the sum of all three. If either - X2 or B2 are zero, then it doesn't contribute to the sum --- this - means that r0 can't be used as either X2 or B2. - - GPR is an array of general register values, indexed by GPR number, - not GDB register number. */ -static void -compute_x_addr (struct prologue_value *addr, - struct prologue_value *gpr, - int d2, unsigned int x2, unsigned int b2) -{ - /* We can't just add stuff directly in addr; it might alias some of - the registers we need to read. */ - struct prologue_value result; - - pv_set_to_constant (&result, d2); - if (x2) - pv_add (&result, &result, &gpr[x2]); - if (b2) - pv_add (&result, &result, &gpr[b2]); - - *addr = result; -} - +/* Prologue analysis. */ #define S390_NUM_GPRS 16 #define S390_NUM_FPRS 16 struct s390_prologue_data { + /* The stack. */ + struct pv_area *stack; + /* The size of a GPR or FPR. */ int gpr_size; int fpr_size; /* The general-purpose registers. */ - struct prologue_value gpr[S390_NUM_GPRS]; + pv_t gpr[S390_NUM_GPRS]; /* The floating-point registers. */ - struct prologue_value fpr[S390_NUM_FPRS]; + pv_t fpr[S390_NUM_FPRS]; /* The offset relative to the CFA where the incoming GPR N was saved by the function prologue. 0 if not saved or unknown. */ @@ -1089,22 +741,44 @@ struct s390_prologue_data { int back_chain_saved_p; }; -/* Do a SIZE-byte store of VALUE to ADDR. */ +/* Return the effective address for an X-style instruction, like: + + L R1, D2(X2, B2) + + Here, X2 and B2 are registers, and D2 is a signed 20-bit + constant; the effective address is the sum of all three. If either + X2 or B2 are zero, then it doesn't contribute to the sum --- this + means that r0 can't be used as either X2 or B2. */ +static pv_t +s390_addr (struct s390_prologue_data *data, + int d2, unsigned int x2, unsigned int b2) +{ + pv_t result; + + result = pv_constant (d2); + if (x2) + result = pv_add (result, data->gpr[x2]); + if (b2) + result = pv_add (result, data->gpr[b2]); + + return result; +} + +/* Do a SIZE-byte store of VALUE to D2(X2,B2). */ static void -s390_store (struct prologue_value *addr, - CORE_ADDR size, - struct prologue_value *value, - struct s390_prologue_data *data) +s390_store (struct s390_prologue_data *data, + int d2, unsigned int x2, unsigned int b2, CORE_ADDR size, + pv_t value) { - struct prologue_value cfa, offset; - int i; + pv_t addr = s390_addr (data, d2, x2, b2); + pv_t offset; /* Check whether we are storing the backchain. */ - pv_subtract (&offset, &data->gpr[S390_SP_REGNUM - S390_R0_REGNUM], addr); + offset = pv_subtract (data->gpr[S390_SP_REGNUM - S390_R0_REGNUM], addr); - if (offset.kind == pv_constant && offset.k == 0) + if (pv_is_constant (offset) && offset.k == 0) if (size == data->gpr_size - && pv_is_register (value, S390_SP_REGNUM, 0)) + && pv_is_register_k (value, S390_SP_REGNUM, 0)) { data->back_chain_saved_p = 1; return; @@ -1112,37 +786,8 @@ s390_store (struct prologue_value *addr, /* Check whether we are storing a register into the stack. */ - pv_set_to_register (&cfa, S390_SP_REGNUM, 16 * data->gpr_size + 32); - pv_subtract (&offset, &cfa, addr); - - if (offset.kind == pv_constant - && offset.k < INT_MAX && offset.k > 0 - && offset.k % data->gpr_size == 0) - { - /* If we are storing the original value of a register, we want to - record the CFA offset. If the same register is stored multiple - times, the stack slot with the highest address counts. */ - - for (i = 0; i < S390_NUM_GPRS; i++) - if (size == data->gpr_size - && pv_is_register (value, S390_R0_REGNUM + i, 0)) - if (data->gpr_slot[i] == 0 - || data->gpr_slot[i] > offset.k) - { - data->gpr_slot[i] = offset.k; - return; - } - - for (i = 0; i < S390_NUM_FPRS; i++) - if (size == data->fpr_size - && pv_is_register (value, S390_F0_REGNUM + i, 0)) - if (data->fpr_slot[i] == 0 - || data->fpr_slot[i] > offset.k) - { - data->fpr_slot[i] = offset.k; - return; - } - } + if (!pv_area_store_would_trash (data->stack, addr)) + pv_area_store (data->stack, addr, size, value); /* Note: If this is some store we cannot identify, you might think we @@ -1153,60 +798,76 @@ s390_store (struct prologue_value *addr, stores. Thus every store we cannot recognize does not hit our data. */ } -/* Do a SIZE-byte load from ADDR into VALUE. */ -static void -s390_load (struct prologue_value *addr, - CORE_ADDR size, - struct prologue_value *value, - struct s390_prologue_data *data) +/* Do a SIZE-byte load from D2(X2,B2). */ +static pv_t +s390_load (struct s390_prologue_data *data, + int d2, unsigned int x2, unsigned int b2, CORE_ADDR size) + { - struct prologue_value cfa, offset; - int i; + pv_t addr = s390_addr (data, d2, x2, b2); + pv_t offset; /* If it's a load from an in-line constant pool, then we can simulate that, under the assumption that the code isn't going to change between the time the processor actually executed it creating the current frame, and the time when we're analyzing the code to unwind past that frame. */ - if (addr->kind == pv_constant) + if (pv_is_constant (addr)) { struct section_table *secp; - secp = target_section_by_addr (¤t_target, addr->k); + secp = target_section_by_addr (¤t_target, addr.k); if (secp != NULL && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section) & SEC_READONLY)) - { - pv_set_to_constant (value, read_memory_integer (addr->k, size)); - return; - } + return pv_constant (read_memory_integer (addr.k, size)); } /* Check whether we are accessing one of our save slots. */ - pv_set_to_register (&cfa, S390_SP_REGNUM, 16 * data->gpr_size + 32); - pv_subtract (&offset, &cfa, addr); + return pv_area_fetch (data->stack, addr, size); +} - if (offset.kind == pv_constant - && offset.k < INT_MAX && offset.k > 0) - { - for (i = 0; i < S390_NUM_GPRS; i++) - if (offset.k == data->gpr_slot[i]) - { - pv_set_to_register (value, S390_R0_REGNUM + i, 0); - return; - } +/* Function for finding saved registers in a 'struct pv_area'; we pass + this to pv_area_scan. - for (i = 0; i < S390_NUM_FPRS; i++) - if (offset.k == data->fpr_slot[i]) - { - pv_set_to_register (value, S390_F0_REGNUM + i, 0); - return; - } - } + If VALUE is a saved register, ADDR says it was saved at a constant + offset from the frame base, and SIZE indicates that the whole + register was saved, record its offset in the reg_offset table in + PROLOGUE_UNTYPED. */ +static void +s390_check_for_saved (void *data_untyped, pv_t addr, CORE_ADDR size, pv_t value) +{ + struct s390_prologue_data *data = data_untyped; + int i, offset; - /* Otherwise, we don't know the value. */ - pv_set_to_unknown (value); + if (!pv_is_register (addr, S390_SP_REGNUM)) + return; + + offset = 16 * data->gpr_size + 32 - addr.k; + + /* If we are storing the original value of a register, we want to + record the CFA offset. If the same register is stored multiple + times, the stack slot with the highest address counts. */ + + for (i = 0; i < S390_NUM_GPRS; i++) + if (size == data->gpr_size + && pv_is_register_k (value, S390_R0_REGNUM + i, 0)) + if (data->gpr_slot[i] == 0 + || data->gpr_slot[i] > offset) + { + data->gpr_slot[i] = offset; + return; + } + + for (i = 0; i < S390_NUM_FPRS; i++) + if (size == data->fpr_size + && pv_is_register_k (value, S390_F0_REGNUM + i, 0)) + if (data->fpr_slot[i] == 0 + || data->fpr_slot[i] > offset) + { + data->fpr_slot[i] = offset; + return; + } } - /* Analyze the prologue of the function starting at START_PC, continuing at most until CURRENT_PC. Initialize DATA to @@ -1238,6 +899,8 @@ s390_analyze_prologue (struct gdbarch *gdbarch, { int i; + data->stack = make_pv_area (S390_SP_REGNUM); + /* For the purpose of prologue tracking, we consider the GPR size to be equal to the ABI word size, even if it is actually larger (i.e. when running a 32-bit binary under a 64-bit kernel). */ @@ -1245,10 +908,10 @@ s390_analyze_prologue (struct gdbarch *gdbarch, data->fpr_size = 8; for (i = 0; i < S390_NUM_GPRS; i++) - pv_set_to_register (&data->gpr[i], S390_R0_REGNUM + i, 0); + data->gpr[i] = pv_register (S390_R0_REGNUM + i, 0); for (i = 0; i < S390_NUM_FPRS; i++) - pv_set_to_register (&data->fpr[i], S390_F0_REGNUM + i, 0); + data->fpr[i] = pv_register (S390_F0_REGNUM + i, 0); for (i = 0; i < S390_NUM_GPRS; i++) data->gpr_slot[i] = 0; @@ -1266,13 +929,17 @@ s390_analyze_prologue (struct gdbarch *gdbarch, bfd_byte insn[S390_MAX_INSTR_SIZE]; int insn_len = s390_readinstruction (insn, pc); + bfd_byte dummy[S390_MAX_INSTR_SIZE] = { 0 }; + bfd_byte *insn32 = word_size == 4 ? insn : dummy; + bfd_byte *insn64 = word_size == 8 ? insn : dummy; + /* Fields for various kinds of instructions. */ unsigned int b2, r1, r2, x2, r3; int i2, d2; /* The values of SP and FP before this instruction, for detecting instructions that change them. */ - struct prologue_value pre_insn_sp, pre_insn_fp; + pv_t pre_insn_sp, pre_insn_fp; /* Likewise for the flag whether the back chain was saved. */ int pre_insn_back_chain_saved_p; @@ -1289,320 +956,126 @@ s390_analyze_prologue (struct gdbarch *gdbarch, pre_insn_fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM]; pre_insn_back_chain_saved_p = data->back_chain_saved_p; - /* LHI r1, i2 --- load halfword immediate */ - if (word_size == 4 - && is_ri (insn, op1_lhi, op2_lhi, &r1, &i2)) - pv_set_to_constant (&data->gpr[r1], i2); - - /* LGHI r1, i2 --- load halfword immediate (64-bit version) */ - else if (word_size == 8 - && is_ri (insn, op1_lghi, op2_lghi, &r1, &i2)) - pv_set_to_constant (&data->gpr[r1], i2); - - /* LGFI r1, i2 --- load fullword immediate */ - else if (is_ril (insn, op1_lgfi, op2_lgfi, &r1, &i2)) - pv_set_to_constant (&data->gpr[r1], i2); - - /* LR r1, r2 --- load from register */ - else if (word_size == 4 - && is_rr (insn, op_lr, &r1, &r2)) - data->gpr[r1] = data->gpr[r2]; - - /* LGR r1, r2 --- load from register (64-bit version) */ - else if (word_size == 8 - && is_rre (insn, op_lgr, &r1, &r2)) - data->gpr[r1] = data->gpr[r2]; - - /* L r1, d2(x2, b2) --- load */ - else if (word_size == 4 - && is_rx (insn, op_l, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 4, &data->gpr[r1], data); - } - - /* LY r1, d2(x2, b2) --- load (long-displacement version) */ - else if (word_size == 4 - && is_rxy (insn, op1_ly, op2_ly, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 4, &data->gpr[r1], data); - } - - /* LG r1, d2(x2, b2) --- load (64-bit version) */ - else if (word_size == 8 - && is_rxy (insn, op1_lg, op2_lg, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 8, &data->gpr[r1], data); - } - - /* ST r1, d2(x2, b2) --- store */ - else if (word_size == 4 - && is_rx (insn, op_st, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_store (&addr, 4, &data->gpr[r1], data); - } - - /* STY r1, d2(x2, b2) --- store (long-displacement version) */ - else if (word_size == 4 - && is_rxy (insn, op1_sty, op2_sty, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_store (&addr, 4, &data->gpr[r1], data); - } - - /* STG r1, d2(x2, b2) --- store (64-bit version) */ - else if (word_size == 8 - && is_rxy (insn, op1_stg, op2_stg, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_store (&addr, 8, &data->gpr[r1], data); - } - - /* STD r1, d2(x2,b2) --- store floating-point register */ + /* LHI r1, i2 --- load halfword immediate. */ + /* LGHI r1, i2 --- load halfword immediate (64-bit version). */ + /* LGFI r1, i2 --- load fullword immediate. */ + if (is_ri (insn32, op1_lhi, op2_lhi, &r1, &i2) + || is_ri (insn64, op1_lghi, op2_lghi, &r1, &i2) + || is_ril (insn, op1_lgfi, op2_lgfi, &r1, &i2)) + data->gpr[r1] = pv_constant (i2); + + /* LR r1, r2 --- load from register. */ + /* LGR r1, r2 --- load from register (64-bit version). */ + else if (is_rr (insn32, op_lr, &r1, &r2) + || is_rre (insn64, op_lgr, &r1, &r2)) + data->gpr[r1] = data->gpr[r2]; + + /* L r1, d2(x2, b2) --- load. */ + /* LY r1, d2(x2, b2) --- load (long-displacement version). */ + /* LG r1, d2(x2, b2) --- load (64-bit version). */ + else if (is_rx (insn32, op_l, &r1, &d2, &x2, &b2) + || is_rxy (insn32, op1_ly, op2_ly, &r1, &d2, &x2, &b2) + || is_rxy (insn64, op1_lg, op2_lg, &r1, &d2, &x2, &b2)) + data->gpr[r1] = s390_load (data, d2, x2, b2, data->gpr_size); + + /* ST r1, d2(x2, b2) --- store. */ + /* STY r1, d2(x2, b2) --- store (long-displacement version). */ + /* STG r1, d2(x2, b2) --- store (64-bit version). */ + else if (is_rx (insn32, op_st, &r1, &d2, &x2, &b2) + || is_rxy (insn32, op1_sty, op2_sty, &r1, &d2, &x2, &b2) + || is_rxy (insn64, op1_stg, op2_stg, &r1, &d2, &x2, &b2)) + s390_store (data, d2, x2, b2, data->gpr_size, data->gpr[r1]); + + /* STD r1, d2(x2,b2) --- store floating-point register. */ else if (is_rx (insn, op_std, &r1, &d2, &x2, &b2)) + s390_store (data, d2, x2, b2, data->fpr_size, data->fpr[r1]); + + /* STM r1, r3, d2(b2) --- store multiple. */ + /* STMY r1, r3, d2(b2) --- store multiple (long-displacement version). */ + /* STMG r1, r3, d2(b2) --- store multiple (64-bit version). */ + else if (is_rs (insn32, op_stm, &r1, &r3, &d2, &b2) + || is_rsy (insn32, op1_stmy, op2_stmy, &r1, &r3, &d2, &b2) + || is_rsy (insn64, op1_stmg, op2_stmg, &r1, &r3, &d2, &b2)) { - struct prologue_value addr; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_store (&addr, 8, &data->fpr[r1], data); - } - - /* STM r1, r3, d2(b2) --- store multiple */ - else if (word_size == 4 - && is_rs (insn, op_stm, &r1, &r3, &d2, &b2)) - { - int regnum; - int offset; - struct prologue_value addr; - - for (regnum = r1, offset = 0; - regnum <= r3; - regnum++, offset += 4) - { - compute_x_addr (&addr, data->gpr, d2 + offset, 0, b2); - s390_store (&addr, 4, &data->gpr[regnum], data); - } - } - - /* STMY r1, r3, d2(b2) --- store multiple (long-displacement version) */ - else if (word_size == 4 - && is_rsy (insn, op1_stmy, op2_stmy, &r1, &r3, &d2, &b2)) - { - int regnum; - int offset; - struct prologue_value addr; - - for (regnum = r1, offset = 0; - regnum <= r3; - regnum++, offset += 4) - { - compute_x_addr (&addr, data->gpr, d2 + offset, 0, b2); - s390_store (&addr, 4, &data->gpr[regnum], data); - } - } - - /* STMG r1, r3, d2(b2) --- store multiple (64-bit version) */ - else if (word_size == 8 - && is_rsy (insn, op1_stmg, op2_stmg, &r1, &r3, &d2, &b2)) - { - int regnum; - int offset; - struct prologue_value addr; - - for (regnum = r1, offset = 0; - regnum <= r3; - regnum++, offset += 8) - { - compute_x_addr (&addr, data->gpr, d2 + offset, 0, b2); - s390_store (&addr, 8, &data->gpr[regnum], data); - } + for (; r1 <= r3; r1++, d2 += data->gpr_size) + s390_store (data, d2, 0, b2, data->gpr_size, data->gpr[r1]); } - /* AHI r1, i2 --- add halfword immediate */ - else if (word_size == 4 - && is_ri (insn, op1_ahi, op2_ahi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], i2); - - /* AGHI r1, i2 --- add halfword immediate (64-bit version) */ - else if (word_size == 8 - && is_ri (insn, op1_aghi, op2_aghi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], i2); - - /* AFI r1, i2 --- add fullword immediate */ - else if (word_size == 4 - && is_ril (insn, op1_afi, op2_afi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], i2); - - /* AGFI r1, i2 --- add fullword immediate (64-bit version) */ - else if (word_size == 8 - && is_ril (insn, op1_agfi, op2_agfi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], i2); - - /* ALFI r1, i2 --- add logical immediate */ - else if (word_size == 4 - && is_ril (insn, op1_alfi, op2_alfi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], (CORE_ADDR)i2 & 0xffffffff); - - /* ALGFI r1, i2 --- add logical immediate (64-bit version) */ - else if (word_size == 8 - && is_ril (insn, op1_algfi, op2_algfi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], (CORE_ADDR)i2 & 0xffffffff); - - /* AR r1, r2 -- add register */ - else if (word_size == 4 - && is_rr (insn, op_ar, &r1, &r2)) - pv_add (&data->gpr[r1], &data->gpr[r1], &data->gpr[r2]); - - /* AGR r1, r2 -- add register (64-bit version) */ - else if (word_size == 8 - && is_rre (insn, op_agr, &r1, &r2)) - pv_add (&data->gpr[r1], &data->gpr[r1], &data->gpr[r2]); - - /* A r1, d2(x2, b2) -- add */ - else if (word_size == 4 - && is_rx (insn, op_a, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - struct prologue_value value; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 4, &value, data); - - pv_add (&data->gpr[r1], &data->gpr[r1], &value); - } - - /* AY r1, d2(x2, b2) -- add (long-displacement version) */ - else if (word_size == 4 - && is_rxy (insn, op1_ay, op2_ay, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - struct prologue_value value; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 4, &value, data); - - pv_add (&data->gpr[r1], &data->gpr[r1], &value); - } - - /* AG r1, d2(x2, b2) -- add (64-bit version) */ - else if (word_size == 8 - && is_rxy (insn, op1_ag, op2_ag, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - struct prologue_value value; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 8, &value, data); - - pv_add (&data->gpr[r1], &data->gpr[r1], &value); - } - - /* SLFI r1, i2 --- subtract logical immediate */ - else if (word_size == 4 - && is_ril (insn, op1_slfi, op2_slfi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], -((CORE_ADDR)i2 & 0xffffffff)); - - /* SLGFI r1, i2 --- subtract logical immediate (64-bit version) */ - else if (word_size == 8 - && is_ril (insn, op1_slgfi, op2_slgfi, &r1, &i2)) - pv_add_constant (&data->gpr[r1], -((CORE_ADDR)i2 & 0xffffffff)); - - /* SR r1, r2 -- subtract register */ - else if (word_size == 4 - && is_rr (insn, op_sr, &r1, &r2)) - pv_subtract (&data->gpr[r1], &data->gpr[r1], &data->gpr[r2]); - - /* SGR r1, r2 -- subtract register (64-bit version) */ - else if (word_size == 8 - && is_rre (insn, op_sgr, &r1, &r2)) - pv_subtract (&data->gpr[r1], &data->gpr[r1], &data->gpr[r2]); - - /* S r1, d2(x2, b2) -- subtract */ - else if (word_size == 4 - && is_rx (insn, op_s, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - struct prologue_value value; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 4, &value, data); - - pv_subtract (&data->gpr[r1], &data->gpr[r1], &value); - } - - /* SY r1, d2(x2, b2) -- subtract (long-displacement version) */ - else if (word_size == 4 - && is_rxy (insn, op1_sy, op2_sy, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - struct prologue_value value; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 4, &value, data); - - pv_subtract (&data->gpr[r1], &data->gpr[r1], &value); - } - - /* SG r1, d2(x2, b2) -- subtract (64-bit version) */ - else if (word_size == 8 - && is_rxy (insn, op1_sg, op2_sg, &r1, &d2, &x2, &b2)) - { - struct prologue_value addr; - struct prologue_value value; - - compute_x_addr (&addr, data->gpr, d2, x2, b2); - s390_load (&addr, 8, &value, data); - - pv_subtract (&data->gpr[r1], &data->gpr[r1], &value); - } - - /* NR r1, r2 --- logical and */ - else if (word_size == 4 - && is_rr (insn, op_nr, &r1, &r2)) - pv_logical_and (&data->gpr[r1], &data->gpr[r1], &data->gpr[r2]); - - /* NGR r1, r2 >--- logical and (64-bit version) */ - else if (word_size == 8 - && is_rre (insn, op_ngr, &r1, &r2)) - pv_logical_and (&data->gpr[r1], &data->gpr[r1], &data->gpr[r2]); - - /* LA r1, d2(x2, b2) --- load address */ - else if (is_rx (insn, op_la, &r1, &d2, &x2, &b2)) - compute_x_addr (&data->gpr[r1], data->gpr, d2, x2, b2); - - /* LAY r1, d2(x2, b2) --- load address (long-displacement version) */ - else if (is_rxy (insn, op1_lay, op2_lay, &r1, &d2, &x2, &b2)) - compute_x_addr (&data->gpr[r1], data->gpr, d2, x2, b2); - - /* LARL r1, i2 --- load address relative long */ + /* AHI r1, i2 --- add halfword immediate. */ + /* AGHI r1, i2 --- add halfword immediate (64-bit version). */ + /* AFI r1, i2 --- add fullword immediate. */ + /* AGFI r1, i2 --- add fullword immediate (64-bit version). */ + else if (is_ri (insn32, op1_ahi, op2_ahi, &r1, &i2) + || is_ri (insn64, op1_aghi, op2_aghi, &r1, &i2) + || is_ril (insn32, op1_afi, op2_afi, &r1, &i2) + || is_ril (insn64, op1_agfi, op2_agfi, &r1, &i2)) + data->gpr[r1] = pv_add_constant (data->gpr[r1], i2); + + /* ALFI r1, i2 --- add logical immediate. */ + /* ALGFI r1, i2 --- add logical immediate (64-bit version). */ + else if (is_ril (insn32, op1_alfi, op2_alfi, &r1, &i2) + || is_ril (insn64, op1_algfi, op2_algfi, &r1, &i2)) + data->gpr[r1] = pv_add_constant (data->gpr[r1], + (CORE_ADDR)i2 & 0xffffffff); + + /* AR r1, r2 -- add register. */ + /* AGR r1, r2 -- add register (64-bit version). */ + else if (is_rr (insn32, op_ar, &r1, &r2) + || is_rre (insn64, op_agr, &r1, &r2)) + data->gpr[r1] = pv_add (data->gpr[r1], data->gpr[r2]); + + /* A r1, d2(x2, b2) -- add. */ + /* AY r1, d2(x2, b2) -- add (long-displacement version). */ + /* AG r1, d2(x2, b2) -- add (64-bit version). */ + else if (is_rx (insn32, op_a, &r1, &d2, &x2, &b2) + || is_rxy (insn32, op1_ay, op2_ay, &r1, &d2, &x2, &b2) + || is_rxy (insn64, op1_ag, op2_ag, &r1, &d2, &x2, &b2)) + data->gpr[r1] = pv_add (data->gpr[r1], + s390_load (data, d2, x2, b2, data->gpr_size)); + + /* SLFI r1, i2 --- subtract logical immediate. */ + /* SLGFI r1, i2 --- subtract logical immediate (64-bit version). */ + else if (is_ril (insn32, op1_slfi, op2_slfi, &r1, &i2) + || is_ril (insn64, op1_slgfi, op2_slgfi, &r1, &i2)) + data->gpr[r1] = pv_add_constant (data->gpr[r1], + -((CORE_ADDR)i2 & 0xffffffff)); + + /* SR r1, r2 -- subtract register. */ + /* SGR r1, r2 -- subtract register (64-bit version). */ + else if (is_rr (insn32, op_sr, &r1, &r2) + || is_rre (insn64, op_sgr, &r1, &r2)) + data->gpr[r1] = pv_subtract (data->gpr[r1], data->gpr[r2]); + + /* S r1, d2(x2, b2) -- subtract. */ + /* SY r1, d2(x2, b2) -- subtract (long-displacement version). */ + /* SG r1, d2(x2, b2) -- subtract (64-bit version). */ + else if (is_rx (insn32, op_s, &r1, &d2, &x2, &b2) + || is_rxy (insn32, op1_sy, op2_sy, &r1, &d2, &x2, &b2) + || is_rxy (insn64, op1_sg, op2_sg, &r1, &d2, &x2, &b2)) + data->gpr[r1] = pv_subtract (data->gpr[r1], + s390_load (data, d2, x2, b2, data->gpr_size)); + + /* LA r1, d2(x2, b2) --- load address. */ + /* LAY r1, d2(x2, b2) --- load address (long-displacement version). */ + else if (is_rx (insn, op_la, &r1, &d2, &x2, &b2) + || is_rxy (insn, op1_lay, op2_lay, &r1, &d2, &x2, &b2)) + data->gpr[r1] = s390_addr (data, d2, x2, b2); + + /* LARL r1, i2 --- load address relative long. */ else if (is_ril (insn, op1_larl, op2_larl, &r1, &i2)) - pv_set_to_constant (&data->gpr[r1], pc + i2 * 2); + data->gpr[r1] = pv_constant (pc + i2 * 2); - /* BASR r1, 0 --- branch and save + /* BASR r1, 0 --- branch and save. Since r2 is zero, this saves the PC in r1, but doesn't branch. */ else if (is_rr (insn, op_basr, &r1, &r2) && r2 == 0) - pv_set_to_constant (&data->gpr[r1], next_pc); + data->gpr[r1] = pv_constant (next_pc); - /* BRAS r1, i2 --- branch relative and save */ + /* BRAS r1, i2 --- branch relative and save. */ else if (is_ri (insn, op1_bras, op2_bras, &r1, &i2)) { - pv_set_to_constant (&data->gpr[r1], next_pc); + data->gpr[r1] = pv_constant (next_pc); next_pc = pc + i2 * 2; /* We'd better not interpret any backward branches. We'll @@ -1636,18 +1109,26 @@ s390_analyze_prologue (struct gdbarch *gdbarch, restore instructions. (The back chain is never restored, just popped.) */ { - struct prologue_value *sp = &data->gpr[S390_SP_REGNUM - S390_R0_REGNUM]; - struct prologue_value *fp = &data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM]; + pv_t sp = data->gpr[S390_SP_REGNUM - S390_R0_REGNUM]; + pv_t fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM]; - if ((! pv_is_identical (&pre_insn_sp, sp) - && ! pv_is_register (sp, S390_SP_REGNUM, 0)) - || (! pv_is_identical (&pre_insn_fp, fp) - && ! pv_is_register (fp, S390_FRAME_REGNUM, 0)) + if ((! pv_is_identical (pre_insn_sp, sp) + && ! pv_is_register_k (sp, S390_SP_REGNUM, 0) + && sp.kind != pvk_unknown) + || (! pv_is_identical (pre_insn_fp, fp) + && ! pv_is_register_k (fp, S390_FRAME_REGNUM, 0) + && fp.kind != pvk_unknown) || pre_insn_back_chain_saved_p != data->back_chain_saved_p) result = next_pc; } } + /* Record where all the registers were saved. */ + pv_area_scan (data->stack, s390_check_for_saved, data); + + free_pv_area (data->stack); + data->stack = NULL; + return result; } @@ -1733,8 +1214,8 @@ s390_prologue_frame_unwind_cache (struct frame_info *next_frame, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int word_size = gdbarch_ptr_bit (gdbarch) / 8; struct s390_prologue_data data; - struct prologue_value *fp = &data.gpr[S390_FRAME_REGNUM - S390_R0_REGNUM]; - struct prologue_value *sp = &data.gpr[S390_SP_REGNUM - S390_R0_REGNUM]; + pv_t *fp = &data.gpr[S390_FRAME_REGNUM - S390_R0_REGNUM]; + pv_t *sp = &data.gpr[S390_SP_REGNUM - S390_R0_REGNUM]; int i; CORE_ADDR cfa; CORE_ADDR func; @@ -1761,7 +1242,7 @@ s390_prologue_frame_unwind_cache (struct frame_info *next_frame, /* If this was successful, we should have found the instruction that sets the stack pointer register to the previous value of the stack pointer minus the frame size. */ - if (sp->kind != pv_register || sp->reg != S390_SP_REGNUM) + if (!pv_is_register (*sp, S390_SP_REGNUM)) return 0; /* A frame size of zero at this point can mean either a real @@ -1793,11 +1274,10 @@ s390_prologue_frame_unwind_cache (struct frame_info *next_frame, Recognize this case by looking ahead a bit ... */ struct s390_prologue_data data2; - struct prologue_value *sp = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM]; + pv_t *sp = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM]; if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR)-1, &data2) - && sp->kind == pv_register - && sp->reg == S390_SP_REGNUM + && pv_is_register (*sp, S390_SP_REGNUM) && sp->k != 0)) return 0; } @@ -1811,7 +1291,7 @@ s390_prologue_frame_unwind_cache (struct frame_info *next_frame, as the stack pointer, we're probably using it. If it holds some other value -- even a constant offset -- it is most likely used as temp register. */ - if (pv_is_identical (sp, fp)) + if (pv_is_identical (*sp, *fp)) frame_pointer = S390_FRAME_REGNUM; else frame_pointer = S390_SP_REGNUM; @@ -2279,7 +1759,8 @@ s390_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) static void s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, - struct dwarf2_frame_state_reg *reg) + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); diff --git a/gdb/serial.c b/gdb/serial.c index 9ee2fa0..fb74e1c 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -184,8 +184,6 @@ serial_open (const char *name) if (strcmp (name, "pc") == 0) ops = serial_interface_lookup ("pc"); - else if (strchr (name, ':')) - ops = serial_interface_lookup ("tcp"); else if (strncmp (name, "lpt", 3) == 0) ops = serial_interface_lookup ("parallel"); else if (strncmp (name, "|", 1) == 0) @@ -193,6 +191,11 @@ serial_open (const char *name) ops = serial_interface_lookup ("pipe"); open_name = name + 1; /* discard ``|'' */ } + /* Check for a colon, suggesting an IP address/port pair. + Do this *after* checking for all the interesting prefixes. We + don't want to constrain the syntax of what can follow them. */ + else if (strchr (name, ':')) + ops = serial_interface_lookup ("tcp"); else ops = serial_interface_lookup ("hardwire"); diff --git a/gdb/sh-stub.c b/gdb/sh-stub.c index bdd9e50..76c98a5 100644 --- a/gdb/sh-stub.c +++ b/gdb/sh-stub.c @@ -403,7 +403,7 @@ retry: count = 0; /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '$') diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index e530893..2b4878e 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2114,6 +2114,58 @@ sh_sh2a_register_sim_regno (int nr) return legacy_register_sim_regno (nr); } +/* Set up the register unwinding such that call-clobbered registers are + not displayed in frames >0 because the true value is not certain. + The 'undefined' registers will show up as 'not available' unless the + CFI says otherwise. + + This function is currently set up for SH4 and compatible only. */ + +static void +sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) +{ + /* Mark the PC as the destination for the return address. */ + if (regnum == PC_REGNUM) + reg->how = DWARF2_FRAME_REG_RA; + + /* Mark the stack pointer as the call frame address. */ + else if (regnum == SP_REGNUM) + reg->how = DWARF2_FRAME_REG_CFA; + + /* The above was taken from the default init_reg in dwarf2-frame.c + while the below is SH specific. */ + + /* Caller save registers. */ + else if ((regnum >= R0_REGNUM && regnum <= R0_REGNUM+7) + || (regnum >= FR0_REGNUM && regnum <= FR0_REGNUM+11) + || (regnum >= DR0_REGNUM && regnum <= DR0_REGNUM+5) + || (regnum >= FV0_REGNUM && regnum <= FV0_REGNUM+2) + || (regnum == MACH_REGNUM) + || (regnum == MACL_REGNUM) + || (regnum == FPUL_REGNUM) + || (regnum == SR_REGNUM)) + reg->how = DWARF2_FRAME_REG_UNDEFINED; + + /* Callee save registers. */ + else if ((regnum >= R0_REGNUM+8 && regnum <= R0_REGNUM+15) + || (regnum >= FR0_REGNUM+12 && regnum <= FR0_REGNUM+15) + || (regnum >= DR0_REGNUM+6 && regnum <= DR0_REGNUM+8) + || (regnum == FV0_REGNUM+3)) + reg->how = DWARF2_FRAME_REG_SAME_VALUE; + + /* Other registers. These are not in the ABI and may or may not + mean anything in frames >0 so don't show them. */ + else if ((regnum >= R0_BANK0_REGNUM && regnum <= R0_BANK0_REGNUM+15) + || (regnum == GBR_REGNUM) + || (regnum == VBR_REGNUM) + || (regnum == FPSCR_REGNUM) + || (regnum == SSR_REGNUM) + || (regnum == SPC_REGNUM)) + reg->how = DWARF2_FRAME_REG_UNDEFINED; +} + static struct sh_frame_cache * sh_alloc_frame_cache (void) { @@ -2492,6 +2544,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p); + dwarf2_frame_set_init_reg (gdbarch, sh_dwarf2_frame_init_reg); + switch (info.bfd_arch_info->mach) { case bfd_mach_sh: diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h index dd9fee8..6d17ba5 100644 --- a/gdb/sh-tdep.h +++ b/gdb/sh-tdep.h @@ -41,6 +41,7 @@ enum FPUL_REGNUM = 23, /* Floating point registers */ FPSCR_REGNUM = 24, + FR0_REGNUM = 25, FLOAT_ARG0_REGNUM = 29, FLOAT_ARGLAST_REGNUM = 36, FP_LAST_REGNUM = 40, diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index ed4e8e5..106ec19 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1524,7 +1524,7 @@ sol_make_note_section (bfd *obfd, int *note_size) } static int -ignore (CORE_ADDR addr, gdb_byte *contents) +ignore (struct bp_target_info *bp_tgt) { return 0; } diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index ffbb252..994953a 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -227,10 +227,9 @@ fetch_lm_info (CORE_ADDR addr) /* The symbol which starts off the list of shared libraries. */ #define DEBUG_BASE "__rld_obj_head" -char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */ +static void *base_breakpoint; static CORE_ADDR debug_base; /* Base of dynamic linker structures */ -static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */ /* @@ -319,11 +318,13 @@ disable_break (void) /* Note that breakpoint address and original contents are in our address space, so we just need to write the original contents back. */ - if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0) + if (deprecated_remove_raw_breakpoint (base_breakpoint) != 0) { status = 0; } + base_breakpoint = NULL; + /* Note that it is possible that we have stopped at a location that is different from the location where we inserted our breakpoint. On mips-irix, we can actually land in __dbx_init(), so we should @@ -352,12 +353,13 @@ disable_break (void) static int enable_break (void) { - if (symfile_objfile != NULL - && target_insert_breakpoint (entry_point_address (), - shadow_contents) == 0) + if (symfile_objfile != NULL) { - breakpoint_addr = entry_point_address (); - return 1; + base_breakpoint + = deprecated_insert_raw_breakpoint (entry_point_address ()); + + if (base_breakpoint != NULL) + return 1; } return 0; diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c index a234402..87da3f1 100644 --- a/gdb/sparc-linux-nat.c +++ b/gdb/sparc-linux-nat.c @@ -20,10 +20,41 @@ Boston, MA 02110-1301, USA. */ #include "defs.h" +#include "regcache.h" + +#include +#include "gregset.h" + +#include "sparc-tdep.h" +#include "sparc-nat.h" #include "inferior.h" #include "target.h" #include "linux-nat.h" +void +supply_gregset (prgregset_t *gregs) +{ + sparc32_supply_gregset (sparc_gregset, current_regcache, -1, gregs); +} + +void +supply_fpregset (prfpregset_t *fpregs) +{ + sparc32_supply_fpregset (current_regcache, -1, fpregs); +} + +void +fill_gregset (prgregset_t *gregs, int regnum) +{ + sparc32_collect_gregset (sparc_gregset, current_regcache, regnum, gregs); +} + +void +fill_fpregset (prfpregset_t *fpregs, int regnum) +{ + sparc32_collect_fpregset (current_regcache, regnum, fpregs); +} + void _initialialize_sparc_linux_nat (void); void diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c index 300db9a..bb1a7f0 100644 --- a/gdb/sparc-linux-tdep.c +++ b/gdb/sparc-linux-tdep.c @@ -20,9 +20,11 @@ Boston, MA 02110-1301, USA. */ #include "defs.h" +#include "dwarf2-frame.h" #include "floatformat.h" #include "frame.h" #include "frame-unwind.h" +#include "regset.h" #include "gdbarch.h" #include "gdbcore.h" #include "osabi.h" @@ -91,7 +93,7 @@ sparc32_linux_sigframe_init (const struct tramp_frame *self, struct trad_frame_cache *this_cache, CORE_ADDR func) { - CORE_ADDR base, addr; + CORE_ADDR base, addr, sp_addr; int regnum; base = frame_unwind_register_unsigned (next_frame, SPARC_O1_REGNUM); @@ -107,13 +109,16 @@ sparc32_linux_sigframe_init (const struct tramp_frame *self, /* Since %g0 is always zero, keep the identity encoding. */ addr = base + 20; + sp_addr = base + 16 + ((SPARC_SP_REGNUM - SPARC_G0_REGNUM) * 4); for (regnum = SPARC_G1_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); addr += 4; } - base = addr = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + base = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + addr = get_frame_memory_unsigned (next_frame, sp_addr, 4); + for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); @@ -122,12 +127,111 @@ sparc32_linux_sigframe_init (const struct tramp_frame *self, trad_frame_set_id (this_cache, frame_id_build (base, func)); } +/* Return the address of a system call's alternative return + address. */ + +static CORE_ADDR +sparc32_linux_step_trap (unsigned long insn) +{ + if (insn == 0x91d02010) + { + ULONGEST sc_num; + + regcache_cooked_read_unsigned (current_regcache, + SPARC_G1_REGNUM, &sc_num); + + /* __NR_rt_sigreturn is 101 and __NR_sigreturn is 216 */ + if (sc_num == 101 || sc_num == 216) + { + ULONGEST sp, pc_offset; + + regcache_cooked_read_unsigned (current_regcache, + SPARC_SP_REGNUM, &sp); + + /* The kernel puts the sigreturn registers on the stack, + and this is where the signal unwinding state is take from + when returning from a signal. + + For __NR_sigreturn, this register area sits 96 bytes from + the base of the stack. The saved PC sits 4 bytes into the + sigreturn register save area. + + For __NR_rt_sigreturn a siginfo_t, which is 128 bytes, sits + right before the sigreturn register save area. */ + + pc_offset = 96 + 4; + if (sc_num == 101) + pc_offset += 128; + + return read_memory_unsigned_integer (sp + pc_offset, 4); + } + } + + return 0; +} + + +const struct sparc_gregset sparc32_linux_core_gregset = +{ + 32 * 4, /* %psr */ + 33 * 4, /* %pc */ + 34 * 4, /* %npc */ + 35 * 4, /* %y */ + -1, /* %wim */ + -1, /* %tbr */ + 1 * 4, /* %g1 */ + 16 * 4, /* %l0 */ + 4, /* y size */ +}; + + +static void +sparc32_linux_supply_core_gregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *gregs, size_t len) +{ + sparc32_supply_gregset (&sparc32_linux_core_gregset, regcache, regnum, gregs); +} + +static void +sparc32_linux_collect_core_gregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *gregs, size_t len) +{ + sparc32_collect_gregset (&sparc32_linux_core_gregset, regcache, regnum, gregs); +} + +static void +sparc32_linux_supply_core_fpregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *fpregs, size_t len) +{ + sparc32_supply_fpregset (regcache, regnum, fpregs); +} + +static void +sparc32_linux_collect_core_fpregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *fpregs, size_t len) +{ + sparc32_collect_fpregset (regcache, regnum, fpregs); +} + + static void sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + tdep->gregset = regset_alloc (gdbarch, sparc32_linux_supply_core_gregset, + sparc32_linux_collect_core_gregset); + tdep->sizeof_gregset = 152; + + tdep->fpregset = regset_alloc (gdbarch, sparc32_linux_supply_core_fpregset, + sparc32_linux_collect_core_fpregset); + tdep->sizeof_fpregset = 396; + tramp_frame_prepend_unwinder (gdbarch, &sparc32_linux_sigframe); tramp_frame_prepend_unwinder (gdbarch, &sparc32_linux_rt_sigframe); @@ -147,6 +251,12 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); + + /* Make sure we can single-step over signal return system calls. */ + tdep->step_trap = sparc32_linux_step_trap; + + /* Hook in the DWARF CFI frame unwinder. */ + frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); } /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb/sparc-stub.c b/gdb/sparc-stub.c index 1e6298a..c12d436 100644 --- a/gdb/sparc-stub.c +++ b/gdb/sparc-stub.c @@ -306,7 +306,7 @@ retry: count = 0; /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '$') diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index dc6c534..797e240 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -22,6 +22,7 @@ #include "defs.h" #include "arch-utils.h" #include "dis-asm.h" +#include "dwarf2-frame.h" #include "floatformat.h" #include "frame.h" #include "frame-base.h" @@ -679,6 +680,23 @@ sparc_frame_cache (struct frame_info *next_frame, void **this_cache) return cache; } +static int +sparc32_struct_return_from_sym (struct symbol *sym) +{ + struct type *type = check_typedef (SYMBOL_TYPE (sym)); + enum type_code code = TYPE_CODE (type); + + if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) + { + type = check_typedef (TYPE_TARGET_TYPE (type)); + if (sparc_structure_or_union_p (type) + || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)) + return 1; + } + + return 0; +} + struct sparc_frame_cache * sparc32_frame_cache (struct frame_info *next_frame, void **this_cache) { @@ -693,16 +711,7 @@ sparc32_frame_cache (struct frame_info *next_frame, void **this_cache) sym = find_pc_function (cache->pc); if (sym) { - struct type *type = check_typedef (SYMBOL_TYPE (sym)); - enum type_code code = TYPE_CODE (type); - - if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) - { - type = check_typedef (TYPE_TARGET_TYPE (type)); - if (sparc_structure_or_union_p (type) - || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)) - cache->struct_return_p = 1; - } + cache->struct_return_p = sparc32_struct_return_from_sym (sym); } else { @@ -994,6 +1003,48 @@ sparc32_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)); } +static int +sparc32_dwarf2_struct_return_p (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_unwind_address_in_block (next_frame); + struct symbol *sym = find_pc_function (pc); + + if (sym) + return sparc32_struct_return_from_sym (sym); + return 0; +} + +static void +sparc32_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) +{ + int off; + + switch (regnum) + { + case SPARC_G0_REGNUM: + /* Since %g0 is always zero, there is no point in saving it, and + people will be inclined omit it from the CFI. Make sure we + don't warn about that. */ + reg->how = DWARF2_FRAME_REG_SAME_VALUE; + break; + case SPARC_SP_REGNUM: + reg->how = DWARF2_FRAME_REG_CFA; + break; + case SPARC32_PC_REGNUM: + case SPARC32_NPC_REGNUM: + reg->how = DWARF2_FRAME_REG_RA_OFFSET; + off = 8; + if (sparc32_dwarf2_struct_return_p (next_frame)) + off += 4; + if (regnum == SPARC32_NPC_REGNUM) + off += 4; + reg->loc.offset = off; + break; + } +} + /* The SPARC Architecture doesn't have hardware single-step support, and most operating systems don't implement it either, so we provide @@ -1085,8 +1136,7 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p) { struct gdbarch *arch = current_gdbarch; struct gdbarch_tdep *tdep = gdbarch_tdep (arch); - static CORE_ADDR npc, nnpc; - static gdb_byte npc_save[4], nnpc_save[4]; + CORE_ADDR npc, nnpc; if (insert_breakpoints_p) { @@ -1098,9 +1148,10 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p) /* Analyze the instruction at PC. */ nnpc = sparc_analyze_control_transfer (arch, pc, &npc); if (npc != 0) - target_insert_breakpoint (npc, npc_save); + insert_single_step_breakpoint (npc); + if (nnpc != 0) - target_insert_breakpoint (nnpc, nnpc_save); + insert_single_step_breakpoint (nnpc); /* Assert that we have set at least one breakpoint, and that they're not set at the same spot - unless we're going @@ -1109,12 +1160,7 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p) gdb_assert (nnpc != npc || orig_npc == 0); } else - { - if (npc != 0) - target_remove_breakpoint (npc, npc_save); - if (nnpc != 0) - target_remove_breakpoint (nnpc, nnpc_save); - } + remove_single_step_breakpoints (); } static void @@ -1245,6 +1291,11 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_base_set_default (gdbarch, &sparc32_frame_base); + /* Hook in the DWARF CFI frame unwinder. */ + dwarf2_frame_set_init_reg (gdbarch, sparc32_dwarf2_frame_init_reg); + /* FIXME: kettenis/20050423: Don't enable the unwinder until the + StackGhost issues have been resolved. */ + /* Hook in ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch); diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c index 730d4f9..9dc9a6c 100644 --- a/gdb/sparc64-linux-nat.c +++ b/gdb/sparc64-linux-nat.c @@ -20,8 +20,13 @@ Boston, MA 02110-1301, USA. */ #include "defs.h" +#include "regcache.h" + +#include +#include "gregset.h" #include "sparc64-tdep.h" +#include "sparc-tdep.h" #include "sparc-nat.h" #include "inferior.h" #include "target.h" @@ -41,6 +46,30 @@ static const struct sparc_gregset sparc64_linux_ptrace_gregset = }; +void +supply_gregset (prgregset_t *gregs) +{ + sparc64_supply_gregset (sparc_gregset, current_regcache, -1, gregs); +} + +void +supply_fpregset (prfpregset_t *fpregs) +{ + sparc64_supply_fpregset (current_regcache, -1, fpregs); +} + +void +fill_gregset (prgregset_t *gregs, int regnum) +{ + sparc64_collect_gregset (sparc_gregset, current_regcache, regnum, gregs); +} + +void +fill_fpregset (prfpregset_t *fpregs, int regnum) +{ + sparc64_collect_fpregset (current_regcache, regnum, fpregs); +} + /* Provide a prototype to silence -Wmissing-prototypes. */ void _initialize_sparc64_linux_nat (void); diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c index 9c64ca6..850f045 100644 --- a/gdb/sparc64-linux-tdep.c +++ b/gdb/sparc64-linux-tdep.c @@ -22,7 +22,11 @@ #include "defs.h" #include "frame.h" #include "frame-unwind.h" +#include "dwarf2-frame.h" +#include "regset.h" +#include "regcache.h" #include "gdbarch.h" +#include "gdbcore.h" #include "osabi.h" #include "solib-svr4.h" #include "symtab.h" @@ -59,7 +63,7 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, struct trad_frame_cache *this_cache, CORE_ADDR func) { - CORE_ADDR base, addr; + CORE_ADDR base, addr, sp_addr; int regnum; base = frame_unwind_register_unsigned (next_frame, SPARC_O1_REGNUM); @@ -69,6 +73,7 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, /* Since %g0 is always zero, keep the identity encoding. */ addr = base + 8; + sp_addr = base + ((SPARC_SP_REGNUM - SPARC_G0_REGNUM) * 8); for (regnum = SPARC_G1_REGNUM; regnum <= SPARC_O7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); @@ -81,11 +86,14 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, trad_frame_set_reg_addr (this_cache, SPARC64_Y_REGNUM, addr + 24); trad_frame_set_reg_addr (this_cache, SPARC64_FPRS_REGNUM, addr + 28); - addr = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + base = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM); + if (base & 1) + base += BIAS; + + addr = get_frame_memory_unsigned (next_frame, sp_addr, 8); if (addr & 1) addr += BIAS; - base = addr; for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++) { trad_frame_set_reg_addr (this_cache, regnum, addr); @@ -94,14 +102,103 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self, trad_frame_set_id (this_cache, frame_id_build (base, func)); } +/* Return the address of a system call's alternative return + address. */ + +static CORE_ADDR +sparc64_linux_step_trap (unsigned long insn) +{ + if (insn == 0x91d0206d) + { + ULONGEST sp; + + regcache_cooked_read_unsigned (current_regcache, + SPARC_SP_REGNUM, &sp); + if (sp & 1) + sp += BIAS; + + /* The kernel puts the sigreturn registers on the stack, + and this is where the signal unwinding state is take from + when returning from a signal. + + A siginfo_t sits 192 bytes from the base of the stack. This + siginfo_t is 128 bytes, and is followed by the sigreturn + register save area. The saved PC sits at a 136 byte offset + into there. */ + + return read_memory_unsigned_integer (sp + 192 + 128 + 136, 8); + } + + return 0; +} + + +const struct sparc_gregset sparc64_linux_core_gregset = +{ + 32 * 8, /* %tstate */ + 33 * 8, /* %tpc */ + 34 * 8, /* %tnpc */ + 35 * 8, /* %y */ + -1, /* %wim */ + -1, /* %tbr */ + 1 * 8, /* %g1 */ + 16 * 8, /* %l0 */ + 8, /* y size */ +}; + + +static void +sparc64_linux_supply_core_gregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *gregs, size_t len) +{ + sparc64_supply_gregset (&sparc64_linux_core_gregset, regcache, regnum, gregs); +} + +static void +sparc64_linux_collect_core_gregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *gregs, size_t len) +{ + sparc64_collect_gregset (&sparc64_linux_core_gregset, regcache, regnum, gregs); +} + +static void +sparc64_linux_supply_core_fpregset (const struct regset *regset, + struct regcache *regcache, + int regnum, const void *fpregs, size_t len) +{ + sparc64_supply_fpregset (regcache, regnum, fpregs); +} + +static void +sparc64_linux_collect_core_fpregset (const struct regset *regset, + const struct regcache *regcache, + int regnum, void *fpregs, size_t len) +{ + sparc64_collect_fpregset (regcache, regnum, fpregs); +} + + static void sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + tdep->gregset = regset_alloc (gdbarch, sparc64_linux_supply_core_gregset, + sparc64_linux_collect_core_gregset); + tdep->sizeof_gregset = 288; + + tdep->fpregset = regset_alloc (gdbarch, sparc64_linux_supply_core_fpregset, + sparc64_linux_collect_core_fpregset); + tdep->sizeof_fpregset = 280; + tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe); + /* Hook in the DWARF CFI frame unwinder. */ + frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer); + sparc64_init_abi (info, gdbarch); /* GNU/Linux has SVR4-style shared libraries... */ @@ -116,6 +213,9 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Enable TLS support. */ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); + + /* Make sure we can single-step over signal return system calls. */ + tdep->step_trap = sparc64_linux_step_trap; } diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index d098bf9..ab6dfab 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -1106,7 +1106,8 @@ sparc64_return_value (struct gdbarch *gdbarch, struct type *type, static void sparc64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, - struct dwarf2_frame_state_reg *reg) + struct dwarf2_frame_state_reg *reg, + struct frame_info *next_frame) { switch (regnum) { diff --git a/gdb/stack.c b/gdb/stack.c index 435bb0c..d0bbc87 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -61,8 +61,6 @@ static void print_frame (struct frame_info *frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal); -static void set_current_sal_from_frame (struct frame_info *, int); - /* Zero means do things normally; we are interacting directly with the user. One means print the full filename and linenumber when a frame is printed, and do so in a format emacs18/emacs19.22 can @@ -373,7 +371,7 @@ print_args_stub (void *args) FRAME, if possible. When CENTER is true, adjust so the relevant line is in the center of the next 'list'. */ -static void +void set_current_sal_from_frame (struct frame_info *frame, int center) { struct symtab_and_line sal; diff --git a/gdb/target.c b/gdb/target.c index fbfc58a..52e4527 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -111,15 +111,15 @@ static void debug_to_prepare_to_store (void); static void debug_to_files_info (struct target_ops *); -static int debug_to_insert_breakpoint (CORE_ADDR, gdb_byte *); +static int debug_to_insert_breakpoint (struct bp_target_info *); -static int debug_to_remove_breakpoint (CORE_ADDR, gdb_byte *); +static int debug_to_remove_breakpoint (struct bp_target_info *); static int debug_to_can_use_hw_breakpoint (int, int, int); -static int debug_to_insert_hw_breakpoint (CORE_ADDR, gdb_byte *); +static int debug_to_insert_hw_breakpoint (struct bp_target_info *); -static int debug_to_remove_hw_breakpoint (CORE_ADDR, gdb_byte *); +static int debug_to_remove_hw_breakpoint (struct bp_target_info *); static int debug_to_insert_watchpoint (CORE_ADDR, int, int); @@ -515,10 +515,10 @@ update_current_target (void) (int (*) (int, int, int)) return_zero); de_fault (to_insert_hw_breakpoint, - (int (*) (CORE_ADDR, gdb_byte *)) + (int (*) (struct bp_target_info *)) return_minus_one); de_fault (to_remove_hw_breakpoint, - (int (*) (CORE_ADDR, gdb_byte *)) + (int (*) (struct bp_target_info *)) return_minus_one); de_fault (to_insert_watchpoint, (int (*) (CORE_ADDR, int, int)) @@ -2075,29 +2075,29 @@ debug_to_files_info (struct target_ops *target) } static int -debug_to_insert_breakpoint (CORE_ADDR addr, gdb_byte *save) +debug_to_insert_breakpoint (struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_breakpoint (addr, save); + retval = debug_target.to_insert_breakpoint (bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_breakpoint (0x%lx, xxx) = %ld\n", - (unsigned long) addr, + (unsigned long) bp_tgt->placed_address, (unsigned long) retval); return retval; } static int -debug_to_remove_breakpoint (CORE_ADDR addr, gdb_byte *save) +debug_to_remove_breakpoint (struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_remove_breakpoint (addr, save); + retval = debug_target.to_remove_breakpoint (bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_remove_breakpoint (0x%lx, xxx) = %ld\n", - (unsigned long) addr, + (unsigned long) bp_tgt->placed_address, (unsigned long) retval); return retval; } @@ -2161,29 +2161,29 @@ debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr) } static int -debug_to_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *save) +debug_to_insert_hw_breakpoint (struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_insert_hw_breakpoint (addr, save); + retval = debug_target.to_insert_hw_breakpoint (bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_insert_hw_breakpoint (0x%lx, xxx) = %ld\n", - (unsigned long) addr, + (unsigned long) bp_tgt->placed_address, (unsigned long) retval); return retval; } static int -debug_to_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *save) +debug_to_remove_hw_breakpoint (struct bp_target_info *bp_tgt) { int retval; - retval = debug_target.to_remove_hw_breakpoint (addr, save); + retval = debug_target.to_remove_hw_breakpoint (bp_tgt); fprintf_unfiltered (gdb_stdlog, "target_remove_hw_breakpoint (0x%lx, xxx) = %ld\n", - (unsigned long) addr, + (unsigned long) bp_tgt->placed_address, (unsigned long) retval); return retval; } diff --git a/gdb/target.h b/gdb/target.h index b804b05..7decfd7 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -30,6 +30,7 @@ struct objfile; struct ui_file; struct mem_attrib; struct target_ops; +struct bp_target_info; /* This include file defines the interface between the main part of the debugger, and the part which is target-specific, or @@ -336,11 +337,11 @@ struct target_ops struct target_ops *target); void (*to_files_info) (struct target_ops *); - int (*to_insert_breakpoint) (CORE_ADDR, gdb_byte *); - int (*to_remove_breakpoint) (CORE_ADDR, gdb_byte *); + int (*to_insert_breakpoint) (struct bp_target_info *); + int (*to_remove_breakpoint) (struct bp_target_info *); int (*to_can_use_hw_breakpoint) (int, int, int); - int (*to_insert_hw_breakpoint) (CORE_ADDR, gdb_byte *); - int (*to_remove_hw_breakpoint) (CORE_ADDR, gdb_byte *); + int (*to_insert_hw_breakpoint) (struct bp_target_info *); + int (*to_remove_hw_breakpoint) (struct bp_target_info *); int (*to_remove_watchpoint) (CORE_ADDR, int, int); int (*to_insert_watchpoint) (CORE_ADDR, int, int); int (*to_stopped_by_watchpoint) (void); @@ -612,22 +613,17 @@ extern void print_section_info (struct target_ops *, bfd *); #define target_files_info() \ (*current_target.to_files_info) (¤t_target) -/* Insert a breakpoint at address ADDR in the target machine. SAVE is - a pointer to memory allocated for saving the target contents. It - is guaranteed by the caller to be long enough to save the number of - breakpoint bytes indicated by BREAKPOINT_FROM_PC. Result is 0 for - success, or an errno value. */ +/* Insert a breakpoint at address BP_TGT->placed_address in the target + machine. Result is 0 for success, or an errno value. */ -#define target_insert_breakpoint(addr, save) \ - (*current_target.to_insert_breakpoint) (addr, save) +#define target_insert_breakpoint(bp_tgt) \ + (*current_target.to_insert_breakpoint) (bp_tgt) -/* Remove a breakpoint at address ADDR in the target machine. - SAVE is a pointer to the same save area - that was previously passed to target_insert_breakpoint. - Result is 0 for success, or an errno value. */ +/* Remove a breakpoint at address BP_TGT->placed_address in the target + machine. Result is 0 for success, or an errno value. */ -#define target_remove_breakpoint(addr, save) \ - (*current_target.to_remove_breakpoint) (addr, save) +#define target_remove_breakpoint(bp_tgt) \ + (*current_target.to_remove_breakpoint) (bp_tgt) /* Initialize the terminal settings we record for the inferior, before we actually run the inferior. */ @@ -1057,11 +1053,11 @@ extern void (*deprecated_target_new_objfile_hook) (struct objfile *); #endif #ifndef target_insert_hw_breakpoint -#define target_insert_hw_breakpoint(addr, save) \ - (*current_target.to_insert_hw_breakpoint) (addr, save) +#define target_insert_hw_breakpoint(bp_tgt) \ + (*current_target.to_insert_hw_breakpoint) (bp_tgt) -#define target_remove_hw_breakpoint(addr, save) \ - (*current_target.to_remove_hw_breakpoint) (addr, save) +#define target_remove_hw_breakpoint(bp_tgt) \ + (*current_target.to_remove_hw_breakpoint) (bp_tgt) #endif extern int target_stopped_data_address_p (struct target_ops *); @@ -1142,13 +1138,13 @@ struct section_table *target_section_by_addr (struct target_ops *target, /* From mem-break.c */ -extern int memory_remove_breakpoint (CORE_ADDR, gdb_byte *); +extern int memory_remove_breakpoint (struct bp_target_info *); -extern int memory_insert_breakpoint (CORE_ADDR, gdb_byte *); +extern int memory_insert_breakpoint (struct bp_target_info *); -extern int default_memory_remove_breakpoint (CORE_ADDR, gdb_byte *); +extern int default_memory_remove_breakpoint (struct bp_target_info *); -extern int default_memory_insert_breakpoint (CORE_ADDR, gdb_byte *); +extern int default_memory_insert_breakpoint (struct bp_target_info *); /* From target.c */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 16d66c7..738ee69 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2006-04-07 Andrew Stubbs + + * gdb.base/commands.exp (recursive_source_test): New test. + +2006-04-04 David S. Miller + + * gdb.base/float.exp: Add pattern for sparc targets. + +2006-03-30 Daniel Jacobowitz + + * gdb.base/commands.exp (stray_arg0_test): New test. + +2006-03-30 Paul Brook + + * gdb.mi/mi-until.exp: kfail broken until command. + * gdb.mi/mi2-until.exp: Ditto. + 2006-03-27 Nick Roberts * gdb.mi/mi-var-child-f.exp, gdb.mi/array.f: New files. diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index eabf85e..e981f81 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -1,5 +1,5 @@ # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1997, 1998, 1999, 2000, -# 2001, 2002, 2003 Free Software Foundation, Inc. +# 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -563,7 +563,60 @@ proc temporary_breakpoint_commands {} { timeout { fail "(timeout) run factorial until temporary breakpoint" } } } - + +# Test that GDB can handle $arg0 outside of user functions without +# crashing. +proc stray_arg0_test { } { + gdb_test "print \$arg0" \ + "\\\$\[0-9\]* = void" \ + "stray_arg0_test #1" + + gdb_test "if 1 == 1\nprint \$arg0\nend" \ + "\\\$\[0-9\]* = void" \ + "stray_arg0_test #2" + + gdb_test "print \$arg0 = 1" \ + "\\\$\[0-9\]* = 1" \ + "stray_arg0_test #3" + + gdb_test "print \$arg0" \ + "\\\$\[0-9\]* = 1" \ + "stray_arg0_test #4" +} + +# Test that GDB can handle arguments when sourcing files recursively. +# If the arguments are overwritten with ####### then the test has failed. +proc recursive_source_test {} { + set fd [open "file1" w] + puts $fd \ +{source file2 +abcdef qwerty} + close $fd + + set fd [open "file2" w] + puts $fd \ +{define abcdef + echo 1: <<<$arg0>>>\n + source file3 + echo 2: <<<$arg0>>>\n +end} + close $fd + + set fd [open "file3" w] + puts $fd \ +"echo in file3\\n +#################################################################" + close $fd + + gdb_test "source file1" \ + "1: <<>>\[\r\n]+in file3\[\r\n]+2: <<>>" \ + "recursive source test" + + file delete file1 + file delete file2 + file delete file3 +} + gdbvar_simple_if_test gdbvar_simple_while_test gdbvar_complex_if_while_test @@ -579,3 +632,5 @@ test_command_prompt_position deprecated_command_test bp_deleted_in_command_test temporary_breakpoint_commands +stray_arg0_test +recursive_source_test diff --git a/gdb/testsuite/gdb.base/float.exp b/gdb/testsuite/gdb.base/float.exp index a814d57..31f9890 100644 --- a/gdb/testsuite/gdb.base/float.exp +++ b/gdb/testsuite/gdb.base/float.exp @@ -81,6 +81,8 @@ if { [istarget "alpha*-*-*"] } then { } } elseif [istarget "hppa*-*"] then { gdb_test "info float" "fr4.*fr4R.*fr31R.*" "info float" +} elseif [istarget "sparc*-*-*"] then { + gdb_test "info float" "f0.*f1.*f31.*d0.*d30.*" "info float" } else { gdb_test "info float" "No floating.point info available for this processor." "info float (unknown target)" } diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp index eb90d0d..ff686af 100644 --- a/gdb/testsuite/gdb.mi/mi-until.exp +++ b/gdb/testsuite/gdb.mi/mi-until.exp @@ -81,6 +81,9 @@ proc test_until {} { -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"12\"\}\r\n$mi_gdb_prompt$" { pass "until after while loop" } + -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"9\"\}\r\n$mi_gdb_prompt$" { + kfail gdb/2104 "until after while loop (went backwards)" + } timeout { fail "until after while loop (timeout)" } diff --git a/gdb/testsuite/gdb.mi/mi2-until.exp b/gdb/testsuite/gdb.mi/mi2-until.exp index f5d9491..760a4a2 100644 --- a/gdb/testsuite/gdb.mi/mi2-until.exp +++ b/gdb/testsuite/gdb.mi/mi2-until.exp @@ -82,6 +82,9 @@ proc test_until {} { -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"12\"\}\r\n$mi_gdb_prompt$" { pass "until after while loop" } + -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"9\"\}\r\n$mi_gdb_prompt$" { + kfail gdb/2104 "until after while loop (went backwards)" + } timeout { fail "until after while loop (timeout)" } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 4b91172..8484daf 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -194,13 +194,15 @@ trace_error (char *buf) /* Utility: wait for reply from stub, while accepting "O" packets. */ static char * -remote_get_noisy_reply (char *buf, - long sizeof_buf) +remote_get_noisy_reply (char **buf_p, + long *sizeof_buf) { do /* Loop on reply from remote stub. */ { + char *buf; QUIT; /* allow user to bail out with ^C */ - getpkt (buf, sizeof_buf, 0); + getpkt (buf_p, sizeof_buf, 0); + buf = *buf_p; if (buf[0] == 0) error (_("Target does not support this command.")); else if (buf[0] == 'E') @@ -1700,7 +1702,8 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr) collect->next_aexpr_elt++; } -static char target_buf[2048]; +static char *target_buf; +static long target_buf_size; /* Set "transparent" memory ranges @@ -1742,7 +1745,7 @@ remote_set_transparent_ranges (void) if (anysecs) { putpkt (target_buf); - getpkt (target_buf, sizeof (target_buf), 0); + getpkt (&target_buf, &target_buf_size, 0); } } @@ -1768,7 +1771,7 @@ trace_start_command (char *args, int from_tty) if (target_is_remote ()) { putpkt ("QTinit"); - remote_get_noisy_reply (target_buf, sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, &target_buf_size); if (strcmp (target_buf, "OK")) error (_("Target does not support this command.")); @@ -1785,7 +1788,7 @@ trace_start_command (char *args, int from_tty) if (t->actions) strcat (buf, "-"); putpkt (buf); - remote_get_noisy_reply (target_buf, sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, &target_buf_size); if (strcmp (target_buf, "OK")) error (_("Target does not support tracepoints.")); @@ -1809,8 +1812,8 @@ trace_start_command (char *args, int from_tty) ((tdp_actions[ndx + 1] || stepping_actions) ? '-' : 0)); putpkt (buf); - remote_get_noisy_reply (target_buf, - sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, + &target_buf_size); if (strcmp (target_buf, "OK")) error (_("Error on target while setting tracepoints.")); } @@ -1826,8 +1829,8 @@ trace_start_command (char *args, int from_tty) stepping_actions[ndx], (stepping_actions[ndx + 1] ? "-" : "")); putpkt (buf); - remote_get_noisy_reply (target_buf, - sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, + &target_buf_size); if (strcmp (target_buf, "OK")) error (_("Error on target while setting tracepoints.")); } @@ -1840,7 +1843,7 @@ trace_start_command (char *args, int from_tty) remote_set_transparent_ranges (); /* Now insert traps and begin collecting data. */ putpkt ("QTStart"); - remote_get_noisy_reply (target_buf, sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, &target_buf_size); if (strcmp (target_buf, "OK")) error (_("Bogus reply from target: %s"), target_buf); set_traceframe_num (-1); /* All old traceframes invalidated. */ @@ -1862,7 +1865,7 @@ trace_stop_command (char *args, int from_tty) if (target_is_remote ()) { putpkt ("QTStop"); - remote_get_noisy_reply (target_buf, sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, &target_buf_size); if (strcmp (target_buf, "OK")) error (_("Bogus reply from target: %s"), target_buf); trace_running_p = 0; @@ -1882,7 +1885,7 @@ trace_status_command (char *args, int from_tty) if (target_is_remote ()) { putpkt ("qTStatus"); - remote_get_noisy_reply (target_buf, sizeof (target_buf)); + remote_get_noisy_reply (&target_buf, &target_buf_size); if (target_buf[0] != 'T' || (target_buf[1] != '0' && target_buf[1] != '1')) @@ -1897,8 +1900,8 @@ trace_status_command (char *args, int from_tty) /* Worker function for the various flavors of the tfind command. */ static void -finish_tfind_command (char *msg, - long sizeof_msg, +finish_tfind_command (char **msg, + long *sizeof_msg, int from_tty) { int target_frameno = -1, target_tracept = -1; @@ -1909,7 +1912,7 @@ finish_tfind_command (char *msg, old_frame_addr = get_frame_base (get_current_frame ()); old_func = find_pc_function (read_pc ()); - putpkt (msg); + putpkt (*msg); reply = remote_get_noisy_reply (msg, sizeof_msg); while (reply && *reply) @@ -2054,7 +2057,7 @@ trace_find_command (char *args, int from_tty) error (_("invalid input (%d is less than zero)"), frameno); sprintf (target_buf, "QTFrame:%x", frameno); - finish_tfind_command (target_buf, sizeof (target_buf), from_tty); + finish_tfind_command (&target_buf, &target_buf_size, from_tty); } else error (_("Trace can only be run on remote targets.")); @@ -2097,7 +2100,7 @@ trace_find_pc_command (char *args, int from_tty) sprintf_vma (tmp, pc); sprintf (target_buf, "QTFrame:pc:%s", tmp); - finish_tfind_command (target_buf, sizeof (target_buf), from_tty); + finish_tfind_command (&target_buf, &target_buf_size, from_tty); } else error (_("Trace can only be run on remote targets.")); @@ -2122,7 +2125,7 @@ trace_find_tracepoint_command (char *args, int from_tty) tdp = parse_and_eval_long (args); sprintf (target_buf, "QTFrame:tdp:%x", tdp); - finish_tfind_command (target_buf, sizeof (target_buf), from_tty); + finish_tfind_command (&target_buf, &target_buf_size, from_tty); } else error (_("Trace can only be run on remote targets.")); @@ -2220,7 +2223,7 @@ trace_find_line_command (char *args, int from_tty) else sprintf (target_buf, "QTFrame:outside:%s:%s", startpc_str, endpc_str); - finish_tfind_command (target_buf, sizeof (target_buf), + finish_tfind_command (&target_buf, &target_buf_size, from_tty); do_cleanups (old_chain); } @@ -2261,7 +2264,7 @@ trace_find_range_command (char *args, int from_tty) sprintf_vma (start_str, start); sprintf_vma (stop_str, stop); sprintf (target_buf, "QTFrame:range:%s:%s", start_str, stop_str); - finish_tfind_command (target_buf, sizeof (target_buf), from_tty); + finish_tfind_command (&target_buf, &target_buf_size, from_tty); } else error (_("Trace can only be run on remote targets.")); @@ -2300,7 +2303,7 @@ trace_find_outside_command (char *args, int from_tty) sprintf_vma (start_str, start); sprintf_vma (stop_str, stop); sprintf (target_buf, "QTFrame:outside:%s:%s", start_str, stop_str); - finish_tfind_command (target_buf, sizeof (target_buf), from_tty); + finish_tfind_command (&target_buf, &target_buf_size, from_tty); } else error (_("Trace can only be run on remote targets.")); @@ -2867,4 +2870,7 @@ Do \"help tracepoints\" for info on other tracepoint commands.")); add_com_alias ("tr", "trace", class_alias, 1); add_com_alias ("tra", "trace", class_alias, 1); add_com_alias ("trac", "trace", class_alias, 1); + + target_buf_size = 2048; + target_buf = xmalloc (target_buf_size); } diff --git a/gdb/value.c b/gdb/value.c index 2e30485..77b92f6 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -755,6 +755,7 @@ lookup_internalvar (char *name) var = (struct internalvar *) xmalloc (sizeof (struct internalvar)); var->name = concat (name, (char *)NULL); var->value = allocate_value (builtin_type_void); + var->endian = TARGET_BYTE_ORDER; release_value (var->value); var->next = internalvars; internalvars = var; @@ -765,12 +766,46 @@ struct value * value_of_internalvar (struct internalvar *var) { struct value *val; + int i, j; + gdb_byte temp; val = value_copy (var->value); if (value_lazy (val)) value_fetch_lazy (val); VALUE_LVAL (val) = lval_internalvar; VALUE_INTERNALVAR (val) = var; + + /* Values are always stored in the target's byte order. When connected to a + target this will most likely always be correct, so there's normally no + need to worry about it. + + However, internal variables can be set up before the target endian is + known and so may become out of date. Fix it up before anybody sees. + + Internal variables usually hold simple scalar values, and we can + correct those. More complex values (e.g. structures and floating + point types) are left alone, because they would be too complicated + to correct. */ + + if (var->endian != TARGET_BYTE_ORDER) + { + gdb_byte *array = value_contents_raw (val); + struct type *type = check_typedef (value_enclosing_type (val)); + switch (TYPE_CODE (type)) + { + case TYPE_CODE_INT: + case TYPE_CODE_PTR: + /* Reverse the bytes. */ + for (i = 0, j = TYPE_LENGTH (type) - 1; i < j; i++, j--) + { + temp = array[j]; + array[j] = array[i]; + array[i] = temp; + } + break; + } + } + return val; } @@ -809,6 +844,7 @@ set_internalvar (struct internalvar *var, struct value *val) long. */ xfree (var->value); var->value = newval; + var->endian = TARGET_BYTE_ORDER; release_value (newval); /* End code which must not call error(). */ } @@ -877,7 +913,8 @@ show_convenience (char *ignore, int from_tty) varseen = 1; } printf_filtered (("$%s = "), var->name); - value_print (var->value, gdb_stdout, 0, Val_pretty_default); + value_print (value_of_internalvar (var), gdb_stdout, + 0, Val_pretty_default); printf_filtered (("\n")); } if (!varseen) diff --git a/gdb/value.h b/gdb/value.h index e197235..a878ec4 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -245,6 +245,7 @@ struct internalvar struct internalvar *next; char *name; struct value *value; + int endian; }; diff --git a/gdb/version.in b/gdb/version.in index 04ba358..70f27cd 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -6.4.50.20060330-cvs +6.4.50.20060420-cvs diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 4248858..abbf4a3 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -354,6 +354,7 @@ do_win32_fetch_inferior_registers (int r) if (current_thread->reload_context) { +#ifdef __COPY_CONTEXT_SIZE if (have_saved_context) { /* Lie about where the program actually is stopped since cygwin has informed us that @@ -363,6 +364,7 @@ do_win32_fetch_inferior_registers (int r) have_saved_context = 0; } else +#endif { thread_info *th = current_thread; th->context.ContextFlags = CONTEXT_DEBUGGER_DR; @@ -928,6 +930,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus) if (strncmp (s, "cYg", 3) != 0) warning (("%s"), s); } +#ifdef __COPY_CONTEXT_SIZE else { /* Got a cygwin signal marker. A cygwin signal is followed by the signal number @@ -955,6 +958,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus) current_event.dwThreadId = retval; } } +#endif if (s) xfree (s); @@ -2341,6 +2345,18 @@ fetch_elf_core_registers (char *core_reg_sect, regcache_raw_supply (current_regcache, r, core_reg_sect + mappings[r]); } +static int +open_symbol_file_object (void *from_ttyp) +{ + return 0; +} + +static int +in_dynsym_resolve_code (CORE_ADDR pc) +{ + return 0; +} + static void init_win32_ops (void) { @@ -2388,8 +2404,8 @@ init_win32_ops (void) win32_so_ops.solib_create_inferior_hook = win32_solib_create_inferior_hook; win32_so_ops.special_symbol_handling = win32_special_symbol_handling; win32_so_ops.current_sos = win32_current_sos; - win32_so_ops.open_symbol_file_object = NULL; - win32_so_ops.in_dynsym_resolve_code = NULL; + win32_so_ops.open_symbol_file_object = open_symbol_file_object; + win32_so_ops.in_dynsym_resolve_code = in_dynsym_resolve_code; /* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */ current_target_so_ops = &win32_so_ops; diff --git a/gdb/wince.c b/gdb/wince.c index 56f4b95..86bfaf6 100644 --- a/gdb/wince.c +++ b/gdb/wince.c @@ -146,7 +146,6 @@ typedef struct thread_info_struct int suspend_count; int stepped; /* True if stepped. */ CORE_ADDR step_pc; - unsigned long step_prev; CONTEXT context; } thread_info; @@ -834,7 +833,7 @@ undoSStep (thread_info * th) { if (th->stepped) { - memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev); + remove_single_step_breakpoints (); th->stepped = 0; } } @@ -857,8 +856,7 @@ wince_software_single_step (enum target_signal ignore, th->stepped = 1; pc = read_register (PC_REGNUM); th->step_pc = mips_next_pc (pc); - th->step_prev = 0; - memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev); + insert_single_step_breakpoint (th->step_pc); return; } #elif SHx @@ -971,7 +969,7 @@ undoSStep (thread_info * th) { if (th->stepped) { - memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev); + remove_single_step_breakpoints (); th->stepped = 0; } return; @@ -996,8 +994,7 @@ wince_software_single_step (enum target_signal ignore, th->stepped = 1; th->step_pc = sh_get_next_pc (&th->context); - th->step_prev = 0; - memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev); + insert_single_step_breakpoint (th->step_pc); return; } #elif defined (ARM) @@ -1024,7 +1021,7 @@ undoSStep (thread_info * th) { if (th->stepped) { - memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev); + remove_single_step_breakpoints (); th->stepped = 0; } } @@ -1047,8 +1044,7 @@ wince_software_single_step (enum target_signal ignore, th->stepped = 1; pc = read_register (PC_REGNUM); th->step_pc = arm_get_next_pc (pc); - th->step_prev = 0; - memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev); + insert_single_step_breakpoint (th->step_pc); return; } #endif diff --git a/include/ChangeLog b/include/ChangeLog index 4af593f..0a3787a 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,12 @@ +2006-04-11 Jim Blandy + + * libiberty.h (pex_input_file, pex_input_pipe): New declarations. + +2006-04-06 H.J. Lu + + * bfdlink.h (bfd_link_info): Replace need_relax_finalize with + relax_pass. + 2006-03-25 Bernd Schmidt * elf/bfin.h (R_BFIN_GOT17M4, R_BFIN_GOTHI, R_BFIN_GOTLO, diff --git a/include/bfdlink.h b/include/bfdlink.h index 3c978e8..f4b7aa7 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -301,9 +301,6 @@ struct bfd_link_info /* TRUE if global symbols in discarded sections should be stripped. */ unsigned int strip_discarded: 1; - /* TRUE if the final relax pass is needed. */ - unsigned int need_relax_finalize: 1; - /* TRUE if generating a position independent executable. */ unsigned int pie: 1; @@ -398,6 +395,12 @@ struct bfd_link_info unloaded. */ const char *fini_function; + /* Number of relaxation passes. Usually only one relaxation pass + is needed. But a backend can have as many relaxation passes as + necessary. During bfd_relax_section call, it is set to the + current pass, starting from 0. */ + int relax_pass; + /* Non-zero if auto-import thunks for DATA items in pei386 DLLs should be generated/linked against. Set to 1 if this feature is explicitly requested by the user, -1 if enabled by default. */ diff --git a/include/libiberty.h b/include/libiberty.h index c264cb2..6bd318e 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -448,6 +448,47 @@ extern const char *pex_run (struct pex_obj *obj, int flags, const char *outname, const char *errname, int *err); +/* Return a `FILE' pointer FP for the standard input of the first + program in the pipeline; FP is opened for writing. You must have + passed `PEX_USE_PIPES' to the `pex_init' call that returned OBJ. + You must close FP yourself with `fclose' to indicate that the + pipeline's input is complete. + + The file descriptor underlying FP is marked not to be inherited by + child processes. + + This call is not supported on systems which do not support pipes; + it returns with an error. (We could implement it by writing a + temporary file, but then you would need to write all your data and + close FP before your first call to `pex_run' -- and that wouldn't + work on systems that do support pipes: the pipe would fill up, and + you would block. So there isn't any easy way to conceal the + differences between the two types of systems.) + + If you call both `pex_write_input' and `pex_read_output', be + careful to avoid deadlock. If the output pipe fills up, so that + each program in the pipeline is waiting for the next to read more + data, and you fill the input pipe by writing more data to FP, then + there is no way to make progress: the only process that could read + data from the output pipe is you, but you are blocked on the input + pipe. */ + +extern FILE *pex_write_input (struct pex_obj *obj, int binary); + +/* Return a stream for a temporary file to pass to the first program + in the pipeline as input. The file name is chosen as for pex_run. + pex_run closes the file automatically; don't close it yourself. */ + +extern FILE *pex_input_file (struct pex_obj *obj, int flags, + const char *in_name); + +/* Return a stream for a pipe connected to the standard input of the + first program in the pipeline. You must have passed + `PEX_USE_PIPES' to `pex_init'. Close the returned stream + yourself. */ + +extern FILE *pex_input_pipe (struct pex_obj *obj, int binary); + /* Read the standard output of the last program to be executed. pex_run can not be called after this. BINARY should be non-zero if the file should be opened in binary mode; this is ignored on Unix. diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 90bf23f..ad4411a 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,7 @@ +2006-04-07 Joerg Wunsch + + * avr.h (AVR_ISA_PWMx): New. + 2006-03-28 Nathan Sidwell * m68k.h (cpu_m68k, cpu_cf, cpu_m68000, cpu_m68008, cpu_m68010, diff --git a/include/opcode/avr.h b/include/opcode/avr.h index b7a80b0..55bb161 100644 --- a/include/opcode/avr.h +++ b/include/opcode/avr.h @@ -1,6 +1,6 @@ /* Opcode table for the Atmel AVR micro controllers. - Copyright 2000, 2001, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2004, 2006 Free Software Foundation, Inc. Contributed by Denis Chertykov This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#define AVR_ISA_1200 0x0001 /* in the beginning there was ... */ +#define AVR_ISA_1200 0x0001 /* In the beginning there was ... */ #define AVR_ISA_LPM 0x0002 /* device has LPM */ #define AVR_ISA_LPMX 0x0004 /* device has LPM Rd,Z[+] */ #define AVR_ISA_SRAM 0x0008 /* device has SRAM (LD, ST, PUSH, POP, ...) */ @@ -32,18 +32,19 @@ #define AVR_ISA_MOVW 0x1000 /* device has MOVW */ #define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM) -#define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM) +#define AVR_ISA_PWMx (AVR_ISA_M8 | AVR_ISA_BRK) +#define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM) #define AVR_ISA_TINY2 (AVR_ISA_2xxx | AVR_ISA_MOVW | AVR_ISA_LPMX | \ - AVR_ISA_SPM | AVR_ISA_BRK) -#define AVR_ISA_M8 (AVR_ISA_2xxx | AVR_ISA_MUL | AVR_ISA_MOVW | \ - AVR_ISA_LPMX | AVR_ISA_SPM) -#define AVR_ISA_M603 (AVR_ISA_2xxx | AVR_ISA_MEGA) -#define AVR_ISA_M103 (AVR_ISA_M603 | AVR_ISA_ELPM) -#define AVR_ISA_M161 (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | \ - AVR_ISA_LPMX | AVR_ISA_SPM) -#define AVR_ISA_94K (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | AVR_ISA_LPMX) -#define AVR_ISA_M323 (AVR_ISA_M161 | AVR_ISA_BRK) -#define AVR_ISA_M128 (AVR_ISA_M323 | AVR_ISA_ELPM | AVR_ISA_ELPMX) + AVR_ISA_SPM | AVR_ISA_BRK) +#define AVR_ISA_M8 (AVR_ISA_2xxx | AVR_ISA_MUL | AVR_ISA_MOVW | \ + AVR_ISA_LPMX | AVR_ISA_SPM) +#define AVR_ISA_M603 (AVR_ISA_2xxx | AVR_ISA_MEGA) +#define AVR_ISA_M103 (AVR_ISA_M603 | AVR_ISA_ELPM) +#define AVR_ISA_M161 (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | \ + AVR_ISA_LPMX | AVR_ISA_SPM) +#define AVR_ISA_94K (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | AVR_ISA_LPMX) +#define AVR_ISA_M323 (AVR_ISA_M161 | AVR_ISA_BRK) +#define AVR_ISA_M128 (AVR_ISA_M323 | AVR_ISA_ELPM | AVR_ISA_ELPMX) #define AVR_ISA_ALL 0xFFFF diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 5007a17..fb328da 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,47 @@ +2006-03-29 Jim Blandy + + * pex-common.c (pex_input_file, pex_input_pipe): New functions. + (pex_init_common): Initialize obj->input_file. + (pex_run): Close any file opened by pex_input_file. + * pexecute.txh (pex_input_file, pex_input_pipe): New docs. + * pex-common.h (struct pex_obj): New field input_file. + (struct pex_funcs): New function ptr fdopenw. + * pex-unix.c (pex_unix_fdopenw): New function. + (funcs): List it as our fdopenw function. + * pex-win32.c (pex_win32_fdopenw): New function. + (funcs): List it as our fdopenw function. + * pex-djgpp.c (funcs): Leave fdopenw null. + * pex-msdos (funcs): Same. + * functions.texi: Regenerated. + +2006-04-10 Jim Blandy + + * pex-common.c (temp_file): New function, containing guts of + pex-style temporary file name generation. + (pex_run): Use it. + +2006-04-06 Carlos O'Donell + + * Makefile.in: Add install-html, install-html-am, and + install-html-recursive targets. Define mkdir_p and + NORMAL_INSTALL. + * configure.ac: AC_SUBST datarootdir, docdir, htmldir. + * configure: Regenerate. + * testsuite/Makefile.in: Add install-html and html targets. + +2006-03-31 Mark Mitchell + + * pex-win32.c (): Include. + (fix_argv): Remove. + (argv_to_cmdline): New function. + (std_suffixes): New variable. + (no_suffixes): Likewise. + (find_executable): New function. + (win32_spawn): Likewise. + (spawn_script): Use win32_spawn instead of _spawnv[p]. + (pex_win32_exec_child): Replace MSVCRT calls with Win32 API calls. + (pex_win32_wait): Likewise. + 2006-03-24 Jim Blandy * pex-common.c (pex_run): Simplify output name handling. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index dcd5ebd..95a8278 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003, 2004, 2005 +# Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation # # This file is part of the libiberty library. @@ -245,7 +245,62 @@ info: libiberty.info info-subdir install-info: install-info-subdir clean-info: clean-info-subdir dvi: libiberty.dvi dvi-subdir -html: libiberty.html + +# html, install-html targets +HTMLS = libiberty.html + +html: $(HTMLS) + +.PHONY: install-html install-html-am install-html-recursive + +NORMAL_INSTALL = : +mkdir_p = mkdir -p -- + +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; + +install-html: install-html-recursive install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" TEXISRC = \ $(srcdir)/libiberty.texi \ diff --git a/libiberty/configure b/libiberty/configure index 59633d5..ed7423a 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libiberty_topdir MAINT NOTMAINT MAKEINFO BUILD_INFO PERL HAVE_PERL build build_cpu build_vendor build_os host host_cpu host_vendor host_os AR ac_ct_AR RANLIB ac_ct_RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP ac_libiberty_warn_cflags NO_MINUS_C_MINUS_O OUTPUT_OPTION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP LIBOBJS CHECK target_header_dir pexecute INSTALL_DEST LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libiberty_topdir MAINT NOTMAINT MAKEINFO BUILD_INFO PERL HAVE_PERL build build_cpu build_vendor build_os host host_cpu host_vendor host_os AR ac_ct_AR RANLIB ac_ct_RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP ac_libiberty_warn_cflags NO_MINUS_C_MINUS_O OUTPUT_OPTION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP LIBOBJS CHECK target_header_dir pexecute INSTALL_DEST datarootdir docdir htmldir LTLIBOBJS' ac_subst_files='host_makefile_frag' # Initialize some variables set by options. @@ -8677,6 +8677,10 @@ for l in x $LIBOBJS; do done LIBOBJS="$L" + + + + # We need multilib support, but only if configuring for the target. ac_config_files="$ac_config_files Makefile testsuite/Makefile" @@ -9354,6 +9358,9 @@ s,@CHECK@,$CHECK,;t t s,@target_header_dir@,$target_header_dir,;t t s,@pexecute@,$pexecute,;t t s,@INSTALL_DEST@,$INSTALL_DEST,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t /@host_makefile_frag@/r $host_makefile_frag s,@host_makefile_frag@,,;t t diff --git a/libiberty/configure.ac b/libiberty/configure.ac index a57685a..76cf3d5 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -639,6 +639,11 @@ for l in x $LIBOBJS; do done LIBOBJS="$L" +dnl Required by html and install-html +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + # We need multilib support, but only if configuring for the target. AC_CONFIG_FILES([Makefile testsuite/Makefile]) AC_CONFIG_COMMANDS([default], diff --git a/libiberty/functions.texi b/libiberty/functions.texi index a09e207..fa92d70 100644 --- a/libiberty/functions.texi +++ b/libiberty/functions.texi @@ -668,14 +668,14 @@ reading and writing. @end deftypefn -@c pexecute.txh:169 +@c pexecute.txh:231 @deftypefn Extension void pex_free (struct pex_obj @var{obj}) Clean up and free all data associated with @var{obj}. @end deftypefn -@c pexecute.txh:144 +@c pexecute.txh:206 @deftypefn Extension int pex_get_status (struct pex_obj *@var{obj}, int @var{count}, int *@var{vector}) Returns the exit status of all programs run using @var{obj}. @@ -685,7 +685,7 @@ to @code{pex_run}. Returns 0 on error, 1 on success. @end deftypefn -@c pexecute.txh:153 +@c pexecute.txh:215 @deftypefn Extension int pex_get_times (struct pex_obj *@var{obj}, int @var{count}, struct pex_time *@var{vector}) Returns the process execution times of all programs run using @@ -702,7 +702,7 @@ process times, all the fields will be set to @code{0}. @end deftypefn -@c pexecute.txh:1 +@c pexecute.txh:2 @deftypefn Extension {struct pex_obj *} pex_init (int @var{flags}, const char *@var{pname}, const char *@var{tempbase}) Prepare to execute one or more programs, with standard output of each @@ -734,7 +734,70 @@ temporary files; it may be @code{NULL} to use a randomly chosen name. @end deftypefn -@c pexecute.txh:175 +@c pexecute.txh:133 +@deftypefn Extension {FILE *} pex_input_file (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{in_name}) + +Return a stream for a temporary file to pass to the first program in +the pipeline as input. + +The name of the input file is chosen according to the same rules +@code{pex_run} uses to choose output file names, based on +@var{in_name}, @var{obj} and the @code{PEX_SUFFIX} bit in @var{flags}. + +Don't call @code{fclose} on the returned stream; the first call to +@code{pex_run} closes it automatically. + +If @var{flags} includes @code{PEX_BINARY_OUTPUT}, open the stream in +binary mode; otherwise, open it in the default mode. Including +@code{PEX_BINARY_OUTPUT} in @var{flags} has no effect on Unix. +@end deftypefn + +@c pexecute.txh:150 +@deftypefn Extension {FILE *} pex_input_pipe (struct pex_obj *@var{obj}, int @var{binary}) + +Return a stream @var{fp} for a pipe connected to the standard input of +the first program in the pipeline; @var{fp} is opened for writing. +You must have passed @code{PEX_USE_PIPES} to the @code{pex_init} call +that returned @var{obj}. + +You must close @var{fp} using @code{fclose} yourself when you have +finished writing data to the pipeline. + +The file descriptor underlying @var{fp} is marked not to be inherited +by child processes. + +On systems that do not support pipes, this function returns +@code{NULL}, and sets @code{errno} to @code{EINVAL}. If you would +like to write code that is portable to all systems the @code{pex} +functions support, consider using @code{pex_input_file} instead. + +There are two opportunities for deadlock using +@code{pex_input_pipe}: + +@itemize @bullet +@item +Most systems' pipes can buffer only a fixed amount of data; a process +that writes to a full pipe blocks. Thus, if you write to @file{fp} +before starting the first process, you run the risk of blocking when +there is no child process yet to read the data and allow you to +continue. @code{pex_input_pipe} makes no promises about the +size of the pipe's buffer, so if you need to write any data at all +before starting the first process in the pipeline, consider using +@code{pex_input_file} instead. + +@item +Using @code{pex_input_pipe} and @code{pex_read_output} together +may also cause deadlock. If the output pipe fills up, so that each +program in the pipeline is waiting for the next to read more data, and +you fill the input pipe by writing more data to @var{fp}, then there +is no way to make progress: the only process that could read data from +the output pipe is you, but you are blocked on the input pipe. + +@end itemize + +@end deftypefn + +@c pexecute.txh:237 @deftypefn Extension {const char *} pex_one (int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{pname}, const char *@var{outname}, const char *@var{errname}, int *@var{status}, int *@var{err}) An interface to permit the easy execution of a @@ -747,7 +810,7 @@ be set to the exit status of the program. @end deftypefn -@c pexecute.txh:132 +@c pexecute.txh:194 @deftypefn Extension {FILE *} pex_read_output (struct pex_obj *@var{obj}, int @var{binary}) Returns a @code{FILE} pointer which may be used to read the standard @@ -760,7 +823,7 @@ it will be closed by @code{pex_free}. @end deftypefn -@c pexecute.txh:32 +@c pexecute.txh:33 @deftypefn Extension {const char *} pex_run (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{outname}, const char *@var{errname}, int *@var{err}) Execute one program in a pipeline. On success this returns @@ -861,7 +924,7 @@ value, or to 0 if there is no relevant @code{errno}. @end deftypefn -@c pexecute.txh:187 +@c pexecute.txh:249 @deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags) This is the old interface to execute one or more programs. It is @@ -889,7 +952,7 @@ name is unset/removed. @end deftypefn -@c pexecute.txh:195 +@c pexecute.txh:257 @deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags}) Another part of the old execution interface. diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c index db842ae..ebe8c43 100644 --- a/libiberty/pex-common.c +++ b/libiberty/pex-common.c @@ -67,6 +67,7 @@ pex_init_common (int flags, const char *pname, const char *tempbase, obj->status = NULL; obj->time = NULL; obj->number_waited = 0; + obj->input_file = NULL; obj->read_output = NULL; obj->remove_count = 0; obj->remove = NULL; @@ -91,6 +92,56 @@ pex_add_remove (struct pex_obj *obj, const char *name, int allocated) obj->remove[obj->remove_count - 1] = add; } +/* Generate a temporary file name based on OBJ, FLAGS, and NAME. + Return NULL if we were unable to reserve a temporary filename. + + If non-NULL, the result is either allocated with malloc, or the + same pointer as NAME. */ +static char * +temp_file (struct pex_obj *obj, int flags, char *name) +{ + if (name == NULL) + { + if (obj->tempbase == NULL) + { + name = make_temp_file (NULL); + } + else + { + int len = strlen (obj->tempbase); + int out; + + if (len >= 6 + && strcmp (obj->tempbase + len - 6, "XXXXXX") == 0) + name = xstrdup (obj->tempbase); + else + name = concat (obj->tempbase, "XXXXXX", NULL); + + out = mkstemps (name, 0); + if (out < 0) + { + free (name); + return NULL; + } + + /* This isn't obj->funcs->close because we got the + descriptor from mkstemps, not from a function in + obj->funcs. Calling close here is just like what + make_temp_file does. */ + close (out); + } + } + else if ((flags & PEX_SUFFIX) != 0) + { + if (obj->tempbase == NULL) + name = make_temp_file (name); + else + name = concat (obj->tempbase, name, NULL); + } + + return name; +} + /* Run a program. */ const char * @@ -111,6 +162,17 @@ pex_run (struct pex_obj *obj, int flags, const char *executable, outname = (char *) orig_outname; outname_allocated = 0; + /* If the user called pex_input_file, close the file now. */ + if (obj->input_file) + { + if (fclose (obj->input_file) == EOF) + { + errmsg = "closing pipeline input file"; + goto error_exit; + } + obj->input_file = NULL; + } + /* Set IN. */ if (obj->next_input_name != NULL) @@ -161,49 +223,16 @@ pex_run (struct pex_obj *obj, int flags, const char *executable, } else if ((obj->flags & PEX_USE_PIPES) == 0) { - if (outname == NULL) - { - if (obj->tempbase == NULL) - { - outname = make_temp_file (NULL); - outname_allocated = 1; - } - else - { - int len = strlen (obj->tempbase); - - if (len >= 6 - && strcmp (obj->tempbase + len - 6, "XXXXXX") == 0) - outname = xstrdup (obj->tempbase); - else - outname = concat (obj->tempbase, "XXXXXX", NULL); - - outname_allocated = 1; - - out = mkstemps (outname, 0); - if (out < 0) - { - *err = 0; - errmsg = "could not create temporary output file"; - goto error_exit; - } - - /* This isn't obj->funcs->close because we got the - descriptor from mkstemps, not from a function in - obj->funcs. Calling close here is just like what - make_temp_file does. */ - close (out); - out = -1; - } - } - else if ((flags & PEX_SUFFIX) != 0) - { - if (obj->tempbase == NULL) - outname = make_temp_file (outname); - else - outname = concat (obj->tempbase, outname, NULL); - outname_allocated = 1; - } + outname = temp_file (obj, flags, outname); + if (! outname) + { + *err = 0; + errmsg = "could not create temporary file"; + goto error_exit; + } + + if (outname != orig_outname) + outname_allocated = 1; if ((obj->flags & PEX_SAVE_TEMPS) == 0) { @@ -290,6 +319,87 @@ pex_run (struct pex_obj *obj, int flags, const char *executable, return errmsg; } +/* Return a FILE pointer for a temporary file to fill with input for + the pipeline. */ +FILE * +pex_input_file (struct pex_obj *obj, int flags, const char *in_name) +{ + char *name = (char *) in_name; + FILE *f; + + /* This must be called before the first pipeline stage is run, and + there must not have been any other input selected. */ + if (obj->count != 0 + || (obj->next_input >= 0 && obj->next_input != STDIN_FILE_NO) + || obj->next_input_name) + { + errno = EINVAL; + return NULL; + } + + name = temp_file (obj, flags, name); + if (! name) + return NULL; + + f = fopen (name, (flags & PEX_BINARY_OUTPUT) ? "wb" : "w"); + if (! f) + { + free (name); + return NULL; + } + + obj->input_file = f; + obj->next_input_name = name; + obj->next_input_name_allocated = (name != in_name); + + return f; +} + +/* Return a stream for a pipe connected to the standard input of the + first stage of the pipeline. */ +FILE * +pex_input_pipe (struct pex_obj *obj, int binary) +{ + int p[2]; + FILE *f; + + /* You must call pex_input_pipe before the first pex_run or pex_one. */ + if (obj->count > 0) + goto usage_error; + + /* You must be using pipes. Implementations that don't support + pipes clear this flag before calling pex_init_common. */ + if (! (obj->flags & PEX_USE_PIPES)) + goto usage_error; + + /* If we have somehow already selected other input, that's a + mistake. */ + if ((obj->next_input >= 0 && obj->next_input != STDIN_FILE_NO) + || obj->next_input_name) + goto usage_error; + + if (obj->funcs->pipe (obj, p, binary != 0) < 0) + return NULL; + + f = obj->funcs->fdopenw (obj, p[WRITE_PORT], binary != 0); + if (! f) + { + int saved_errno = errno; + obj->funcs->close (obj, p[READ_PORT]); + obj->funcs->close (obj, p[WRITE_PORT]); + errno = saved_errno; + return NULL; + } + + obj->next_input = p[READ_PORT]; + + return f; + + usage_error: + errno = EINVAL; + return NULL; +} + /* Return a FILE pointer for the output of the last program executed. */ diff --git a/libiberty/pex-common.h b/libiberty/pex-common.h index b70b38d..8ded138 100644 --- a/libiberty/pex-common.h +++ b/libiberty/pex-common.h @@ -69,6 +69,8 @@ struct pex_obj struct pex_time *time; /* Number of children we have already waited for. */ int number_waited; + /* FILE created by pex_input_file. */ + FILE *input_file; /* FILE created by pex_read_output. */ FILE *read_output; /* Number of temporary files to remove. */ @@ -121,6 +123,11 @@ struct pex_funcs PEX_USE_PIPES is set). If BINARY is non-zero, open in binary mode. Return pointer on success, NULL on error. */ FILE * (*fdopenr) (struct pex_obj *, int /* fd */, int /* binary */); + /* Get a FILE pointer to write to the file descriptor FD (only + called if PEX_USE_PIPES is set). If BINARY is non-zero, open in + binary mode. Arrange for FD not to be inherited by the child + processes. Return pointer on success, NULL on error. */ + FILE * (*fdopenw) (struct pex_obj *, int /* fd */, int /* binary */); /* Free any system dependent data associated with OBJ. May be NULL if there is nothing to do. */ void (*cleanup) (struct pex_obj *); diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c index 6e58e3f..17fbf2c 100644 --- a/libiberty/pex-djgpp.c +++ b/libiberty/pex-djgpp.c @@ -62,6 +62,7 @@ const struct pex_funcs funcs = pex_djgpp_wait, NULL, /* pipe */ NULL, /* fdopenr */ + NULL, /* fdopenw */ NULL /* cleanup */ }; diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c index 2256117..db22337 100644 --- a/libiberty/pex-msdos.c +++ b/libiberty/pex-msdos.c @@ -73,6 +73,7 @@ const struct pex_funcs funcs = pex_msdos_wait, NULL, /* pipe */ NULL, /* fdopenr */ + NULL, /* fdopenw */ pex_msdos_cleanup }; diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c index 35a545c..c92a429 100644 --- a/libiberty/pex-unix.c +++ b/libiberty/pex-unix.c @@ -277,6 +277,7 @@ static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *, int, const char **, int *); static int pex_unix_pipe (struct pex_obj *, int *, int); static FILE *pex_unix_fdopenr (struct pex_obj *, int, int); +static FILE *pex_unix_fdopenw (struct pex_obj *, int, int); static void pex_unix_cleanup (struct pex_obj *); /* The list of functions we pass to the common routines. */ @@ -290,6 +291,7 @@ const struct pex_funcs funcs = pex_unix_wait, pex_unix_pipe, pex_unix_fdopenr, + pex_unix_fdopenw, pex_unix_cleanup }; @@ -495,6 +497,15 @@ pex_unix_fdopenr (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd, return fdopen (fd, "r"); } +static FILE * +pex_unix_fdopenw (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd, + int binary ATTRIBUTE_UNUSED) +{ + if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) + return NULL; + return fdopen (fd, "w"); +} + static void pex_unix_cleanup (struct pex_obj *obj ATTRIBUTE_UNUSED) { diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c index ed45e5b..046f393 100644 --- a/libiberty/pex-win32.c +++ b/libiberty/pex-win32.c @@ -41,6 +41,7 @@ Boston, MA 02110-1301, USA. */ #include #include #include +#include /* mingw32 headers may not define the following. */ @@ -72,115 +73,6 @@ backslashify (char *s) return; } -/* This is a kludge to get around the Microsoft C spawn functions' propensity - to remove the outermost set of double quotes from all arguments. */ - -static const char * const * -fix_argv (char * const *argvec) -{ - char **argv; - int i; - char *command0; - - /* See whether we need to change anything. */ - for (command0 = argvec[0]; *command0 != '\0'; command0++) - if (*command0 == '/') - break; - if (*command0 == '\0') - { - for (i = 1; argvec[i] != NULL; i++) - if (strpbrk (argvec[i], "\" \t") != NULL) - break; - - if (argvec[i] == NULL) - return (const char * const *) argvec; - } - - for (i = 0; argvec[i] != NULL; i++) - ; - argv = XNEWVEC (char *, i + 2); - - argv++; /* Leave space at the beginning of argv - for potential #! handling */ - - for (i = 0; argvec[i] != NULL; i++) - argv[i] = xstrdup (argvec[i]); - argv[i] = NULL; - - backslashify (argv[0]); - - for (i = 1; argv[i] != 0; i++) - { - int len, j; - char *temp, *newtemp; - - temp = argv[i]; - len = strlen (temp); - for (j = 0; j < len; j++) - { - if (temp[j] == '"') - { - newtemp = XNEWVEC (char, len + 2); - strncpy (newtemp, temp, j); - newtemp [j] = '\\'; - strncpy (&newtemp [j+1], &temp [j], len-j); - newtemp [len+1] = 0; - temp = newtemp; - len++; - j++; - } - } - - if (argv[i] != temp) - { - free (argv[i]); - argv[i] = temp; - } - } - - for (i = 0; argv[i] != 0; i++) - { - if (strpbrk (argv[i], " \t")) - { - int len, trailing_backslash; - char *temp; - - len = strlen (argv[i]); - trailing_backslash = 0; - - /* There is an added complication when an arg with embedded white - space ends in a backslash (such as in the case of -iprefix arg - passed to cpp). The resulting quoted strings gets misinterpreted - by the command interpreter -- it thinks that the ending quote - is escaped by the trailing backslash and things get confused. - We handle this case by escaping the trailing backslash, provided - it was not escaped in the first place. */ - if (len > 1 - && argv[i][len-1] == '\\' - && argv[i][len-2] != '\\') - { - trailing_backslash = 1; - ++len; /* to escape the final backslash. */ - } - - len += 2; /* and for the enclosing quotes. */ - - temp = XNEWVEC (char, len + 1); - temp[0] = '"'; - strcpy (temp + 1, argv[i]); - if (trailing_backslash) - temp[len - 2] = '\\'; - temp[len - 1] = '"'; - temp[len] = '\0'; - - free (argv[i]); - argv[i] = temp; - } - } - - return (const char * const *) argv; -} - static int pex_win32_open_read (struct pex_obj *, const char *, int); static int pex_win32_open_write (struct pex_obj *, const char *, int); static long pex_win32_exec_child (struct pex_obj *, int, const char *, @@ -191,6 +83,7 @@ static int pex_win32_wait (struct pex_obj *, long, int *, struct pex_time *, int, const char **, int *); static int pex_win32_pipe (struct pex_obj *, int *, int); static FILE *pex_win32_fdopenr (struct pex_obj *, int, int); +static FILE *pex_win32_fdopenw (struct pex_obj *, int, int); /* The list of functions we pass to the common routines. */ @@ -203,6 +96,7 @@ const struct pex_funcs funcs = pex_win32_wait, pex_win32_pipe, pex_win32_fdopenr, + pex_win32_fdopenw, NULL /* cleanup */ }; @@ -422,8 +316,225 @@ msys_rootify (const char *executable) } #endif +/* Return a Windows command-line from ARGV. It is the caller's + responsibility to free the string returned. */ + +static char * +argv_to_cmdline (char *const *argv) +{ + char *cmdline; + char *p; + size_t cmdline_len; + int i, j, k; + + cmdline_len = 0; + for (i = 0; argv[i]; i++) + { + /* We quote every last argument. This simplifies the problem; + we need only escape embedded double-quotes and immediately + preceeding backslash characters. A sequence of backslach characters + that is not follwed by a double quote character will not be + escaped. */ + for (j = 0; argv[i][j]; j++) + { + if (argv[i][j] == '"') + { + /* Escape preceeding backslashes. */ + for (k = j - 1; k >= 0 && argv[i][k] == '\\'; k--) + cmdline_len++; + /* Escape the qote character. */ + cmdline_len++; + } + } + /* Trailing backslashes also need to be escaped because they will be + followed by the terminating quote. */ + for (k = j - 1; k >= 0 && argv[i][k] == '\\'; k--) + cmdline_len++; + cmdline_len += j; + cmdline_len += 3; /* for leading and trailing quotes and space */ + } + cmdline = xmalloc (cmdline_len); + p = cmdline; + for (i = 0; argv[i]; i++) + { + *p++ = '"'; + for (j = 0; argv[i][j]; j++) + { + if (argv[i][j] == '"') + { + for (k = j - 1; k >= 0 && argv[i][k] == '\\'; k--) + *p++ = '\\'; + *p++ = '\\'; + } + *p++ = argv[i][j]; + } + for (k = j - 1; k >= 0 && argv[i][k] == '\\'; k--) + *p++ = '\\'; + *p++ = '"'; + *p++ = ' '; + } + p[-1] = '\0'; + return cmdline; +} + +static const char *const +std_suffixes[] = { + ".com", + ".exe", + ".bat", + ".cmd", + 0 +}; +static const char *const +no_suffixes[] = { + "", + 0 +}; + +/* Returns the full path to PROGRAM. If SEARCH is true, look for + PROGRAM in each directory in PATH. */ + +static char * +find_executable (const char *program, BOOL search) +{ + char *full_executable; + char *e; + size_t fe_len; + const char *path = 0; + const char *const *ext; + const char *p, *q; + size_t proglen = strlen (program); + int has_extension = !!strchr (program, '.'); + int has_slash = (strchr (program, '/') || strchr (program, '\\')); + HANDLE h; + + if (has_slash) + search = FALSE; + + if (search) + path = getenv ("PATH"); + if (!path) + path = ""; + + fe_len = 0; + for (p = path; *p; p = q) + { + q = p; + while (*q != ';' && *q != '\0') + q++; + if ((size_t)(q - p) > fe_len) + fe_len = q - p; + if (*q == ';') + q++; + } + fe_len = fe_len + 1 + proglen + (has_extension ? 1 : 5); + full_executable = xmalloc (fe_len); + + p = path; + do + { + q = p; + while (*q != ';' && *q != '\0') + q++; + + e = full_executable; + memcpy (e, p, q - p); + e += (q - p); + if (q - p) + *e++ = '\\'; + strcpy (e, program); + + if (*q == ';') + q++; + + for (e = full_executable; *e; e++) + if (*e == '/') + *e = '\\'; + + /* At this point, e points to the terminating NUL character for + full_executable. */ + for (ext = has_extension ? no_suffixes : std_suffixes; *ext; ext++) + { + /* Remove any current extension. */ + *e = '\0'; + /* Add the new one. */ + strcat (full_executable, *ext); + + /* Attempt to open this file. */ + h = CreateFile (full_executable, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + if (h != INVALID_HANDLE_VALUE) + goto found; + } + p = q; + } + while (*p); + free (full_executable); + return 0; + + found: + CloseHandle (h); + return full_executable; +} + +/* Low-level process creation function. */ + static long -spawn_script (const char *executable, const char * const * argv) +win32_spawn (const char *executable, + BOOL search, + char *const *argv, + DWORD dwCreationFlags, + LPSTARTUPINFO si, + LPPROCESS_INFORMATION pi) +{ + char *full_executable; + char *cmdline; + + full_executable = NULL; + cmdline = NULL; + + full_executable = find_executable (executable, search); + if (!full_executable) + goto error; + cmdline = argv_to_cmdline (argv); + if (!cmdline) + goto error; + + /* Create the child process. */ + if (!CreateProcess (full_executable, cmdline, + /*lpProcessAttributes=*/NULL, + /*lpThreadAttributes=*/NULL, + /*bInheritHandles=*/TRUE, + dwCreationFlags, + /*lpEnvironment=*/NULL, + /*lpCurrentDirectory=*/NULL, + si, + pi)) + { + free (full_executable); + return -1; + } + + /* Clean up. */ + CloseHandle (pi->hThread); + free (full_executable); + + return (long) pi->hProcess; + + error: + if (cmdline) + free (cmdline); + if (full_executable) + free (full_executable); + return -1; +} + +static long +spawn_script (const char *executable, char *const *argv, + DWORD dwCreationFlags, + LPSTARTUPINFO si, + LPPROCESS_INFORMATION pi) { int pid = -1; int save_errno = errno; @@ -455,17 +566,21 @@ spawn_script (const char *executable, const char * const * argv) executable = strrchr (executable1, '\\') + 1; if (!executable) executable = executable1; - pid = _spawnvp (_P_NOWAIT, executable, argv); + pid = win32_spawn (executable, TRUE, argv, + dwCreationFlags, si, pi); #else if (strchr (executable1, '\\') == NULL) - pid = _spawnvp (_P_NOWAIT, executable1, argv); + pid = win32_spawn (executable1, TRUE, argv, + dwCreationFlags, si, pi); else if (executable1[0] != '\\') - pid = _spawnv (_P_NOWAIT, executable1, argv); + pid = win32_spawn (executable1, FALSE, argv, + dwCreationFlags, si, pi); else { const char *newex = mingw_rootify (executable1); *avhere = newex; - pid = _spawnv (_P_NOWAIT, newex, argv); + pid = win32_spawn (newex, FALSE, argv, + dwCreationFlags, si, pi); if (executable1 != newex) free ((char *) newex); if (pid < 0) @@ -474,7 +589,8 @@ spawn_script (const char *executable, const char * const * argv) if (newex != executable1) { *avhere = newex; - pid = _spawnv (_P_NOWAIT, newex, argv); + pid = win32_spawn (newex, FALSE, argv, + dwCreationFlags, si, pi); free ((char *) newex); } } @@ -496,149 +612,95 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags, int in, int out, int errdes, const char **errmsg, int *err) { - int org_in, org_out, org_errdes; long pid; - const char * const * newargv; - - org_in = -1; - org_out = -1; - org_errdes = -1; - - if (in != STDIN_FILE_NO) - { - org_in = _dup (STDIN_FILE_NO); - if (org_in < 0) - { - *err = errno; - *errmsg = "_dup"; - return -1; - } - if (_dup2 (in, STDIN_FILE_NO) < 0) - { - *err = errno; - *errmsg = "_dup2"; - return -1; - } - if (_close (in) < 0) - { - *err = errno; - *errmsg = "_close"; - return -1; - } - } - - if (out != STDOUT_FILE_NO) - { - org_out = _dup (STDOUT_FILE_NO); - if (org_out < 0) - { - *err = errno; - *errmsg = "_dup"; - return -1; - } - if (_dup2 (out, STDOUT_FILE_NO) < 0) - { - *err = errno; - *errmsg = "_dup2"; - return -1; - } - if (_close (out) < 0) - { - *err = errno; - *errmsg = "_close"; - return -1; - } - } - - if (errdes != STDERR_FILE_NO - || (flags & PEX_STDERR_TO_STDOUT) != 0) + HANDLE stdin_handle; + HANDLE stdout_handle; + HANDLE stderr_handle; + DWORD dwCreationFlags; + OSVERSIONINFO version_info; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + stdin_handle = INVALID_HANDLE_VALUE; + stdout_handle = INVALID_HANDLE_VALUE; + stderr_handle = INVALID_HANDLE_VALUE; + + stdin_handle = (HANDLE) _get_osfhandle (in); + stdout_handle = (HANDLE) _get_osfhandle (out); + if (!(flags & PEX_STDERR_TO_STDOUT)) + stderr_handle = (HANDLE) _get_osfhandle (errdes); + else + stderr_handle = stdout_handle; + + /* Determine the version of Windows we are running on. */ + version_info.dwOSVersionInfoSize = sizeof (version_info); + GetVersionEx (&version_info); + if (version_info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + /* On Windows 95/98/ME the CREATE_NO_WINDOW flag is not + supported, so we cannot avoid creating a console window. */ + dwCreationFlags = 0; + else { - org_errdes = _dup (STDERR_FILE_NO); - if (org_errdes < 0) - { - *err = errno; - *errmsg = "_dup"; - return -1; - } - if (_dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes, - STDERR_FILE_NO) < 0) - { - *err = errno; - *errmsg = "_dup2"; - return -1; - } - if (errdes != STDERR_FILE_NO) + HANDLE conout_handle; + + /* Determine whether or not we have an associated console. */ + conout_handle = CreateFile("CONOUT$", + GENERIC_WRITE, + FILE_SHARE_WRITE, + /*lpSecurityAttributes=*/NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + /*hTemplateFile=*/NULL); + if (conout_handle == INVALID_HANDLE_VALUE) + /* There is no console associated with this process. Since + the child is a console process, the OS would normally + create a new console Window for the child. Since we'll be + redirecting the child's standard streams, we do not need + the console window. */ + dwCreationFlags = CREATE_NO_WINDOW; + else { - if (_close (errdes) < 0) - { - *err = errno; - *errmsg = "_close"; - return -1; - } + /* There is a console associated with the process, so the OS + will not create a new console. And, if we use + CREATE_NO_WINDOW in this situation, the child will have + no associated console. Therefore, if the child's + standard streams are connected to the console, the output + will be discarded. */ + CloseHandle(conout_handle); + dwCreationFlags = 0; } } - newargv = fix_argv (argv); - pid = (((flags & PEX_SEARCH) != 0 ? _spawnvp : _spawnv) - (_P_NOWAIT, executable, newargv)); - + /* Since the child will be a console process, it will, by default, + connect standard input/output to its console. However, we want + the child to use the handles specifically designated above. In + addition, if there is no console (such as when we are running in + a Cygwin X window), then we must redirect the child's + input/output, as there is no console for the child to use. */ + memset (&si, 0, sizeof (si)); + si.cb = sizeof (si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = stdin_handle; + si.hStdOutput = stdout_handle; + si.hStdError = stderr_handle; + + /* Create the child process. */ + pid = win32_spawn (executable, (flags & PEX_SEARCH) != 0, + argv, dwCreationFlags, &si, &pi); if (pid == -1) - pid = spawn_script (executable, newargv); - + pid = spawn_script (executable, argv, dwCreationFlags, &si, &pi); if (pid == -1) { - *err = errno; - *errmsg = ((flags & PEX_SEARCH) != 0) ? "_spawnvp" : "_spawnv"; - } - - if (in != STDIN_FILE_NO) - { - if (_dup2 (org_in, STDIN_FILE_NO) < 0) - { - *err = errno; - *errmsg = "_dup2"; - return -1; - } - if (_close (org_in) < 0) - { - *err = errno; - *errmsg = "_close"; - return -1; - } - } - - if (out != STDOUT_FILE_NO) - { - if (_dup2 (org_out, STDOUT_FILE_NO) < 0) - { - *err = errno; - *errmsg = "_dup2"; - return -1; - } - if (_close (org_out) < 0) - { - *err = errno; - *errmsg = "_close"; - return -1; - } + *err = ENOENT; + *errmsg = "CreateProcess"; } - if (errdes != STDERR_FILE_NO - || (flags & PEX_STDERR_TO_STDOUT) != 0) - { - if (_dup2 (org_errdes, STDERR_FILE_NO) < 0) - { - *err = errno; - *errmsg = "_dup2"; - return -1; - } - if (_close (org_errdes) < 0) - { - *err = errno; - *errmsg = "_close"; - return -1; - } - } + /* Close the standard output and standard error handles in the + parent. */ + if (out != STDOUT_FILENO) + obj->funcs->close (obj, out); + if (errdes != STDERR_FILENO) + obj->funcs->close (obj, errdes); return pid; } @@ -656,30 +718,34 @@ pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, long pid, int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED, const char **errmsg, int *err) { - int termstat; + DWORD termstat; + HANDLE h; if (time != NULL) memset (time, 0, sizeof *time); + h = (HANDLE) pid; + /* FIXME: If done is non-zero, we should probably try to kill the process. */ - - if (_cwait (&termstat, pid, WAIT_CHILD) < 0) + if (WaitForSingleObject (h, INFINITE) != WAIT_OBJECT_0) { - *err = errno; - *errmsg = "_cwait"; + CloseHandle (h); + *err = ECHILD; + *errmsg = "WaitForSingleObject"; return -1; } - /* cwait returns the child process exit code in termstat. A value - of 3 indicates that the child caught a signal, but not which one. - Since only SIGABRT, SIGFPE and SIGINT do anything, we report - SIGABRT. */ - + GetExitCodeProcess (h, &termstat); + CloseHandle (h); + + /* A value of 3 indicates that the child caught a signal, but not + which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we + report SIGABRT. */ if (termstat == 3) *status = SIGABRT; else - *status = ((termstat & 0xff) << 8); + *status = (termstat & 0xff) << 8; return 0; } @@ -702,6 +768,18 @@ pex_win32_fdopenr (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd, return fdopen (fd, binary ? "rb" : "r"); } +static FILE * +pex_win32_fdopenw (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd, + int binary) +{ + HANDLE h = (HANDLE) _get_osfhandle (fd); + if (h == INVALID_HANDLE_VALUE) + return NULL; + if (! SetHandleInformation (h, HANDLE_FLAG_INHERIT, 0)) + return NULL; + return fdopen (fd, binary ? "wb" : "w"); +} + #ifdef MAIN #include diff --git a/libiberty/pexecute.txh b/libiberty/pexecute.txh index 461ff33..7d45576 100644 --- a/libiberty/pexecute.txh +++ b/libiberty/pexecute.txh @@ -1,3 +1,4 @@ +@c -*- mode: texinfo -*- @deftypefn Extension {struct pex_obj *} pex_init (int @var{flags}, const char *@var{pname}, const char *@var{tempbase}) Prepare to execute one or more programs, with standard output of each @@ -129,6 +130,67 @@ value, or to 0 if there is no relevant @code{errno}. @end deftypefn +@deftypefn Extension {FILE *} pex_input_file (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{in_name}) + +Return a stream for a temporary file to pass to the first program in +the pipeline as input. + +The name of the input file is chosen according to the same rules +@code{pex_run} uses to choose output file names, based on +@var{in_name}, @var{obj} and the @code{PEX_SUFFIX} bit in @var{flags}. + +Don't call @code{fclose} on the returned stream; the first call to +@code{pex_run} closes it automatically. + +If @var{flags} includes @code{PEX_BINARY_OUTPUT}, open the stream in +binary mode; otherwise, open it in the default mode. Including +@code{PEX_BINARY_OUTPUT} in @var{flags} has no effect on Unix. +@end deftypefn + +@deftypefn Extension {FILE *} pex_input_pipe (struct pex_obj *@var{obj}, int @var{binary}) + +Return a stream @var{fp} for a pipe connected to the standard input of +the first program in the pipeline; @var{fp} is opened for writing. +You must have passed @code{PEX_USE_PIPES} to the @code{pex_init} call +that returned @var{obj}. + +You must close @var{fp} using @code{fclose} yourself when you have +finished writing data to the pipeline. + +The file descriptor underlying @var{fp} is marked not to be inherited +by child processes. + +On systems that do not support pipes, this function returns +@code{NULL}, and sets @code{errno} to @code{EINVAL}. If you would +like to write code that is portable to all systems the @code{pex} +functions support, consider using @code{pex_input_file} instead. + +There are two opportunities for deadlock using +@code{pex_input_pipe}: + +@itemize @bullet +@item +Most systems' pipes can buffer only a fixed amount of data; a process +that writes to a full pipe blocks. Thus, if you write to @file{fp} +before starting the first process, you run the risk of blocking when +there is no child process yet to read the data and allow you to +continue. @code{pex_input_pipe} makes no promises about the +size of the pipe's buffer, so if you need to write any data at all +before starting the first process in the pipeline, consider using +@code{pex_input_file} instead. + +@item +Using @code{pex_input_pipe} and @code{pex_read_output} together +may also cause deadlock. If the output pipe fills up, so that each +program in the pipeline is waiting for the next to read more data, and +you fill the input pipe by writing more data to @var{fp}, then there +is no way to make progress: the only process that could read data from +the output pipe is you, but you are blocked on the input pipe. + +@end itemize + +@end deftypefn + @deftypefn Extension {FILE *} pex_read_output (struct pex_obj *@var{obj}, int @var{binary}) Returns a @code{FILE} pointer which may be used to read the standard diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 67e1d28..534626e 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1999, 2002 +# Copyright (C) 1999, 2002, 2006 # Free Software Foundation # # This file is part of the libiberty library. @@ -73,7 +73,7 @@ test-expandargv: $(srcdir)/test-expandargv.c ../libiberty.a $(srcdir)/test-expandargv.c ../libiberty.a # Standard (either GNU or Cygnus) rules we don't use. -info install-info clean-info dvi install etags tags installcheck: +html install-html info install-info clean-info dvi install etags tags installcheck: # The standard clean rules. mostlyclean: diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index ae0eb64..8637a8b 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,42 @@ +2006-04-19 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + +2006-04-19 Alan Modra + + * avr-dis.c (avr_operand): Warning fix. + + * configure: Regenerate. + +2006-04-16 Daniel Jacobowitz + + * po/POTFILES.in: Regenerated. + +2006-04-12 Hochstein + + PR binutils/2454 + * avr-dis.c (avr_operand): Arrange for a comment to appear before + the symolic form of an address, so that the output of objdump -d + can be reassembled. + +2006-04-10 DJ Delorie + + * m32c-asm.c: Regenerate. + +2006-04-06 Carlos O'Donell + + * Makefile.am: Add install-html target. + * Makefile.in: Regenerate. + +2006-04-06 Nick Clifton + + * po/vi/po: Updated Vietnamese translation. + +2006-03-31 Paul Koning + + * pdp11-opc.c (pdp11_opcodes): Fix opcode for SEC instruction. + 2006-03-16 Bernd Schmidt * bfin-dis.c (decode_dsp32shiftimm_0): Simplify and correct the diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index 8d03307..2a29b55 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -15,6 +15,9 @@ AM_CFLAGS = $(WARN_CFLAGS) bfdlibdir = @bfdlibdir@ bfdincludedir = @bfdincludedir@ +.PHONY: install-html +install-html: + bfdlib_LTLIBRARIES = libopcodes.la # This is where bfd.h lives. @@ -971,6 +974,25 @@ vax-dis.lo: vax-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h w65-dis.lo: w65-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h +xc16x-asm.lo: xc16x-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h $(INCDIR)/xregex.h \ + $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +xc16x-desc.lo: xc16x-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/xregex.h $(INCDIR)/xregex2.h +xc16x-dis.lo: xc16x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \ + xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + xc16x-opc.h opintl.h +xc16x-ibld.lo: xc16x-ibld.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + xc16x-opc.h opintl.h $(INCDIR)/safe-ctype.h +xc16x-opc.lo: xc16x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h xc16x-opc.h $(INCDIR)/libiberty.h xstormy16-asm.lo: xstormy16-asm.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \ $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ @@ -993,23 +1015,6 @@ xstormy16-opc.lo: xstormy16-opc.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \ $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ xstormy16-opc.h $(INCDIR)/libiberty.h -xc16x-asm.lo: xc16x-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen.h \ - xc16x-opc.h opintl.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h \ - $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h -xc16x-desc.lo: xc16x-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen.h \ - xc16x-opc.h opintl.h $(INCDIR)/libiberty.h $(INCDIR)/xregex.h \ - $(INCDIR)/xregex2.h -xc16x-dis.lo: xc16x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \ - xc16x-desc.h $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h -xc16x-ibld.lo: xc16x-ibld.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h \ - $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h $(INCDIR)/safe-ctype.h -xc16x-opc.lo: xc16x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen.h \ - xc16x-opc.h $(INCDIR)/libiberty.h xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \ $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h sysdep.h \ config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index a28ff0e..9029085 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -933,6 +933,9 @@ uninstall-info: uninstall-info-recursive uninstall-bfdlibLTLIBRARIES uninstall-info-am +.PHONY: install-html +install-html: + disassemble.lo: disassemble.c $(INCDIR)/dis-asm.h $(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $(srcdir)/disassemble.c @@ -1513,6 +1516,25 @@ vax-dis.lo: vax-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h w65-dis.lo: w65-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ w65-opc.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h +xc16x-asm.lo: xc16x-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h $(INCDIR)/xregex.h \ + $(INCDIR)/xregex2.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +xc16x-desc.lo: xc16x-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/xregex.h $(INCDIR)/xregex2.h +xc16x-dis.lo: xc16x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \ + xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + xc16x-opc.h opintl.h +xc16x-ibld.lo: xc16x-ibld.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + xc16x-opc.h opintl.h $(INCDIR)/safe-ctype.h +xc16x-opc.lo: xc16x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h xc16x-opc.h $(INCDIR)/libiberty.h xstormy16-asm.lo: xstormy16-asm.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \ $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ @@ -1535,23 +1557,6 @@ xstormy16-opc.lo: xstormy16-opc.c sysdep.h config.h \ $(INCDIR)/ansidecl.h $(BFD_H) $(INCDIR)/symcat.h xstormy16-desc.h \ $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ xstormy16-opc.h $(INCDIR)/libiberty.h -xc16x-asm.lo: xc16x-asm.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen.h \ - xc16x-opc.h opintl.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h \ - $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h -xc16x-desc.lo: xc16x-desc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen.h \ - xc16x-opc.h opintl.h $(INCDIR)/libiberty.h $(INCDIR)/xregex.h \ - $(INCDIR)/xregex2.h -xc16x-dis.lo: xc16x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/libiberty.h \ - xc16x-desc.h $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h -xc16x-ibld.lo: xc16x-ibld.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h \ - $(INCDIR)/opcode/cgen.h xc16x-opc.h opintl.h $(INCDIR)/safe-ctype.h -xc16x-opc.lo: xc16x-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ - $(BFD_H) $(INCDIR)/symcat.h xc16x-desc.h $(INCDIR)/opcode/cgen.h \ - xc16x-opc.h $(INCDIR)/libiberty.h xtensa-dis.lo: xtensa-dis.c $(INCDIR)/xtensa-isa.h \ $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h sysdep.h \ config.h $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c index 1530084..ac37752 100644 --- a/opcodes/avr-dis.c +++ b/opcodes/avr-dis.c @@ -139,7 +139,12 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra case 'h': *sym = 1; *sym_addr = ((((insn & 1) | ((insn & 0x1f0) >> 3)) << 16) | insn2) * 2; - sprintf (buf, "0x"); + /* See PR binutils/2545. Ideally we would like to display the hex + value of the address only once, but this would mean recoding + objdump_print_address() which would affect many targets. */ + sprintf (buf, "%#lx", (unsigned long ) *sym_addr); + sprintf (comment, "0x"); + break; case 'L': diff --git a/opcodes/configure b/opcodes/configure index b692e83..da29cc3 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -858,8 +858,8 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --enable-targets alternative target configurations --enable-commonbfdlib build shared BFD/opcodes/libiberty library - --enable-werror treat compile warnings as errors - --enable-build-warnings Enable build-time compiler warnings + --enable-werror treat compile warnings as errors + --enable-build-warnings enable build-time compiler warnings --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-install-libbfd controls installation of libbfd and related headers diff --git a/opcodes/m32c-asm.c b/opcodes/m32c-asm.c index 9407ed8..5af5d75 100644 --- a/opcodes/m32c-asm.c +++ b/opcodes/m32c-asm.c @@ -578,13 +578,14 @@ parse_Bitno16R (CGEN_CPU_DESC cd, const char **strp, static const char * parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep, - unsigned bits) + unsigned bits, int allow_syms) { const char *errmsg = 0; unsigned long bit; unsigned long base; const char *newp = *strp; unsigned long long bitbase; + long have_zero = 0; errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); if (errmsg) @@ -594,6 +595,11 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, return "Missing base for bit,base:8"; ++newp; + + if (strncmp (newp, "0x0", 3) == 0 + || (newp[0] == '0' && newp[1] != 'x')) + have_zero = 1; + errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & base); if (errmsg) return errmsg; @@ -603,6 +609,21 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, if (bitbase >= (1ull << bits)) return _("bit,base is out of range"); + /* If this field may require a relocation then use larger displacement. */ + if (! have_zero && base == 0) + { + switch (allow_syms) { + case 0: + return _("bit,base out of range for symbol"); + case 1: + break; + case 2: + if (strncmp (newp, "[sb]", 4) != 0) + return _("bit,base out of range for symbol"); + break; + } + } + *valuep = bitbase; *strp = newp; return 0; @@ -611,7 +632,7 @@ parse_unsigned_bitbase (CGEN_CPU_DESC cd, const char **strp, static const char * parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep, - unsigned bits) + unsigned bits, int allow_syms) { const char *errmsg = 0; unsigned long bit; @@ -619,6 +640,7 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, const char *newp = *strp; long long bitbase; long long limit; + long have_zero = 0; errmsg = cgen_parse_unsigned_integer (cd, & newp, opindex, & bit); if (errmsg) @@ -628,6 +650,11 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, return "Missing base for bit,base:8"; ++newp; + + if (strncmp (newp, "0x0", 3) == 0 + || (newp[0] == '0' && newp[1] != 'x')) + have_zero = 1; + errmsg = cgen_parse_signed_integer (cd, & newp, opindex, & base); if (errmsg) return errmsg; @@ -638,6 +665,10 @@ parse_signed_bitbase (CGEN_CPU_DESC cd, const char **strp, if (bitbase < -limit || bitbase >= limit) return _("bit,base is out of range"); + /* If this field may require a relocation then use larger displacement. */ + if (! have_zero && base == 0 && ! allow_syms) + return _("bit,base out of range for symbol"); + *valuep = bitbase; *strp = newp; return 0; @@ -647,56 +678,56 @@ static const char * parse_unsigned_bitbase8 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 8, 0); } static const char * parse_unsigned_bitbase11 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 11, 0); } static const char * parse_unsigned_bitbase16 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 16, 1); } static const char * parse_unsigned_bitbase19 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 19, 2); } static const char * parse_unsigned_bitbase27 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { - return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27); + return parse_unsigned_bitbase (cd, strp, opindex, valuep, 27, 1); } static const char * parse_signed_bitbase8 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { - return parse_signed_bitbase (cd, strp, opindex, valuep, 8); + return parse_signed_bitbase (cd, strp, opindex, valuep, 8, 1); } static const char * parse_signed_bitbase11 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { - return parse_signed_bitbase (cd, strp, opindex, valuep, 11); + return parse_signed_bitbase (cd, strp, opindex, valuep, 11, 0); } static const char * parse_signed_bitbase19 (CGEN_CPU_DESC cd, const char **strp, int opindex, signed long *valuep) { - return parse_signed_bitbase (cd, strp, opindex, valuep, 19); + return parse_signed_bitbase (cd, strp, opindex, valuep, 19, 1); } /* Parse the suffix as : or as nothing followed by a whitespace. */ diff --git a/opcodes/pdp11-opc.c b/opcodes/pdp11-opc.c index 8b96e78..5fdb084 100644 --- a/opcodes/pdp11-opc.c +++ b/opcodes/pdp11-opc.c @@ -1,5 +1,5 @@ /* Opcode table for PDP-11. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2006 Free Software Foundation, Inc. This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ const struct pdp11_opcode pdp11_opcodes[] = { "cl_e", 0x00ae, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, { "ccc", 0x00af, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, { "se_0", 0x00b0, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, - { "sec", 0x00a1, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, + { "sec", 0x00b1, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, { "sev", 0x00b2, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, { "se_3", 0x00b3, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, { "sez", 0x00b4, 0xffff, PDP11_OPCODE_NO_OPS, PDP11_BASIC }, diff --git a/opcodes/po/Make-in b/opcodes/po/Make-in index 5e35426..4f338bc 100644 --- a/opcodes/po/Make-in +++ b/opcodes/po/Make-in @@ -1,6 +1,6 @@ # Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006 Free Software Foundation, Inc. # # This file may be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License @@ -110,6 +110,7 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot install: install-exec install-data install-exec: install-info: +install-html: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in index ddb7f95..67e98c4 100644 --- a/opcodes/po/POTFILES.in +++ b/opcodes/po/POTFILES.in @@ -150,6 +150,13 @@ v850-opc.c vax-dis.c w65-dis.c w65-opc.h +xc16x-asm.c +xc16x-desc.c +xc16x-desc.h +xc16x-dis.c +xc16x-ibld.c +xc16x-opc.c +xc16x-opc.h xstormy16-asm.c xstormy16-desc.c xstormy16-desc.h diff --git a/opcodes/po/vi.po b/opcodes/po/vi.po index 9cf88ed..957c33d 100644 --- a/opcodes/po/vi.po +++ b/opcodes/po/vi.po @@ -1,18 +1,20 @@ -# Vietnamese Translation for opcodes-2.15.96. +# Vietnamese Translation for Opcodes. # Copyright © 2005 Free Software Foundation, Inc. # Clytie Siddall , 2005. # msgid "" msgstr "" -"Project-Id-Version: opcodes 2.15.96\n" +"Project-Id-Version: opcodes-2.15.96\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2005-03-05 20:32+1030\n" -"PO-Revision-Date: 2005-05-04 21:52+0930\n" +"PO-Revision-Date: 2006-04-05 15:14+0930\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"X-Generator: LocFactoryEditor 1.6b36\n" #: alpha-opc.c:331 msgid "branch operand unaligned" @@ -24,7 +26,7 @@ msgstr "chÆ°a canh lá» lá»i gợi ý nhảy" #: arc-dis.c:76 msgid "Illegal limm reference in last instruction!\n" -msgstr "Không cho phép tham chiếu loại limm trong câu lệnh cuối cùng.\n" +msgstr "Không cho phép tham chiếu kiểu limm trong câu lệnh cuối cùng.\n" #: arm-dis.c:1267 msgid "" @@ -65,7 +67,7 @@ msgstr "lá»—i rã ná»™i bá»™" #: avr-dis.c:227 #, c-format msgid "unknown constraint `%c'" -msgstr "không biết ràng buá»™c `%c'" +msgstr "không biết ràng buá»™c « %c »" #: cgen-asm.c:336 fr30-ibld.c:197 frv-ibld.c:197 ip2k-ibld.c:197 #: iq2000-ibld.c:197 m32r-ibld.c:197 openrisc-ibld.c:197 xstormy16-ibld.c:197 @@ -120,13 +122,13 @@ msgstr "không chấp nhận câu lệnh" #: m32r-asm.c:569 openrisc-asm.c:483 xstormy16-asm.c:515 #, c-format msgid "syntax error (expected char `%c', found `%c')" -msgstr "gặp lá»—i cú pháp (ngá» ký tá»± `%c', còn tìm `%c')" +msgstr "gặp lá»—i cú pháp (ngá» ký tá»± « %c », còn tìm « %c »)" #: fr30-asm.c:564 frv-asm.c:1539 ip2k-asm.c:771 iq2000-asm.c:706 #: m32r-asm.c:579 openrisc-asm.c:493 xstormy16-asm.c:525 #, c-format msgid "syntax error (expected char `%c', found end of instruction)" -msgstr "gặp lá»—i cú pháp (ngá» ký tá»± `%c', còn tìm kết thức câu lệnh)" +msgstr "gặp lá»—i cú pháp (ngá» ký tá»± « %c », còn tìm kết thức câu lệnh)" #: fr30-asm.c:592 frv-asm.c:1567 ip2k-asm.c:799 iq2000-asm.c:734 #: m32r-asm.c:607 openrisc-asm.c:521 xstormy16-asm.c:553 @@ -142,19 +144,19 @@ msgstr "không chấp nhận dạng câu lệnh" #: m32r-asm.c:725 openrisc-asm.c:639 xstormy16-asm.c:671 #, c-format msgid "bad instruction `%.50s...'" -msgstr "câu lệnh sai `%.50s'" +msgstr "câu lệnh sai « %.50s »" #: fr30-asm.c:713 frv-asm.c:1688 ip2k-asm.c:920 iq2000-asm.c:855 #: m32r-asm.c:728 openrisc-asm.c:642 xstormy16-asm.c:674 #, c-format msgid "bad instruction `%.50s'" -msgstr "câu lệnh sai `%.50s'" +msgstr "câu lệnh sai « %.50s »" #. Default text to print if an instruction isn't recognized. #: fr30-dis.c:41 frv-dis.c:41 ip2k-dis.c:41 iq2000-dis.c:41 m32r-dis.c:41 #: mmix-dis.c:284 openrisc-dis.c:41 xstormy16-dis.c:41 msgid "*unknown*" -msgstr "*không biết*" +msgstr " • không rõ •" #: fr30-dis.c:319 frv-dis.c:410 ip2k-dis.c:313 iq2000-dis.c:191 m32r-dis.c:262 #: openrisc-dis.c:137 xstormy16-dis.c:170 @@ -178,7 +180,7 @@ msgstr "tác tá»­ ở ngoại phạm vị (%lu không phải ở giữa 0 và %l #: m32r-ibld.c:667 openrisc-ibld.c:635 xstormy16-ibld.c:680 #, c-format msgid "Unrecognized field %d while building insn.\n" -msgstr "Không chấp nhận trÆ°á»ng %d trong khi xây dụng câu lệnh.\n" +msgstr "Không chấp nhận trÆ°á»ng %d trong khi xây dá»±ng câu lệnh.\n" #: fr30-ibld.c:939 frv-ibld.c:1177 ip2k-ibld.c:686 iq2000-ibld.c:892 #: m32r-ibld.c:806 openrisc-ibld.c:737 xstormy16-ibld.c:828 @@ -190,25 +192,25 @@ msgstr "Không chấp nhận trÆ°á»ng %d trong khi giải mã câu lệnh.\n" #: m32r-ibld.c:922 openrisc-ibld.c:817 xstormy16-ibld.c:941 #, c-format msgid "Unrecognized field %d while getting int operand.\n" -msgstr "Không chấp nhận trÆ°á»ng %d trong khi gá»i tác tá»­ số nguyên.\n" +msgstr "Không chấp nhận trÆ°á»ng %d trong khi lấy tác tá»­ số nguyên.\n" #: fr30-ibld.c:1217 frv-ibld.c:1719 ip2k-ibld.c:820 iq2000-ibld.c:1140 #: m32r-ibld.c:1018 openrisc-ibld.c:877 xstormy16-ibld.c:1034 #, c-format msgid "Unrecognized field %d while getting vma operand.\n" -msgstr "Không chấp nhận trÆ°á»ng %d trong khi gá»i tác tá»­ vma.\n" +msgstr "Không chấp nhận trÆ°á»ng %d trong khi lấy tác tá»­ vma.\n" #: fr30-ibld.c:1351 frv-ibld.c:1989 ip2k-ibld.c:882 iq2000-ibld.c:1263 #: m32r-ibld.c:1122 openrisc-ibld.c:946 xstormy16-ibld.c:1136 #, c-format msgid "Unrecognized field %d while setting int operand.\n" -msgstr "Không chấp nhận trÆ°á»ng %d trong khi lập tác tá»­ số nguyên.\n" +msgstr "Không chấp nhận trÆ°á»ng %d trong khi đặt tác tá»­ số nguyên.\n" #: fr30-ibld.c:1473 frv-ibld.c:2247 ip2k-ibld.c:932 iq2000-ibld.c:1374 #: m32r-ibld.c:1214 openrisc-ibld.c:1003 xstormy16-ibld.c:1226 #, c-format msgid "Unrecognized field %d while setting vma operand.\n" -msgstr "Không chấp nhận trÆ°á»ng %d trong khi lập tác tá»­ vma.\n" +msgstr "Không chấp nhận trÆ°á»ng %d trong khi đặt tác tá»­ vma.\n" #: frv-asm.c:978 msgid "register number must be even" @@ -227,13 +229,13 @@ msgstr "Không hiểu 0x%x \n" #: h8500-dis.c:143 #, c-format msgid "can't cope with insert %d\n" -msgstr "không quản lý được Ä‘iá»u chèn %d\n" +msgstr "không thể xá»­ lý Ä‘iá»u chèn %d\n" #. Couldn't understand anything. #: h8500-dis.c:342 #, c-format msgid "%02x\t\t*unknown*" -msgstr "°không biết*%02x\t\t" +msgstr "%02x\t\t • không rõ •" #: i386-dis.c:1733 msgid "" @@ -247,21 +249,21 @@ msgstr "%s: Lá»—i" #: ia64-gen.c:310 #, c-format msgid "%s: Warning: " -msgstr "%s: Cảnh báo" +msgstr "%s: Cảnh báo : " #: ia64-gen.c:496 ia64-gen.c:730 #, c-format msgid "multiple note %s not handled\n" -msgstr "không quản lý được Ä‘a chú thích %s\n" +msgstr "không xá»­ lý được Ä‘a chú thích %s\n" #: ia64-gen.c:607 msgid "can't find ia64-ic.tbl for reading\n" -msgstr "không tìm được ia64-ic.tbl để Ä‘á»c\n" +msgstr "không tìm thấy ia64-ic.tbl để Ä‘á»c\n" #: ia64-gen.c:812 #, c-format msgid "can't find %s for reading\n" -msgstr "không tìm được %s để Ä‘á»c\n" +msgstr "không tìm thấy %s để Ä‘á»c\n" #: ia64-gen.c:1036 #, c-format @@ -269,18 +271,18 @@ msgid "" "most recent format '%s'\n" "appears more restrictive than '%s'\n" msgstr "" -"hình nhÆ° dạng thức gần đây nhất '%s'\n" -"giá»›i hạn hÆ¡n '%s'\n" +"dạng thức gần đây nhất « %s »\n" +"có vẻ hạn hẹp hÆ¡n « %s »\n" #: ia64-gen.c:1047 #, c-format msgid "overlapping field %s->%s\n" -msgstr "trÆ°á»ng chồng lấp %s->%s\n" +msgstr "trÆ°á»ng chồng lấp %s → %s\n" #: ia64-gen.c:1244 #, c-format msgid "overwriting note %d with note %d (IC:%s)\n" -msgstr "Ä‘ang ghi Ä‘á» chú thích %d vá»›i chú thích %d (IC:%s)\n" +msgstr "Ä‘ang ghi đè chú thích %d bằng chú thích %d (IC:%s)\n" #: ia64-gen.c:1443 #, c-format @@ -320,7 +322,7 @@ msgstr "đã định nghÄ©a còn chÆ°a sá»­ dụng hạng %s\n" #: ia64-gen.c:1541 #, c-format msgid "Warning: rsrc %s (%s) has no chks%s\n" -msgstr "Cảnh báo: tài nguyên %s (%s) không có cản trở %s\n" +msgstr "Cảnh báo : tài nguyên %s (%s) không có cản trở %s\n" #: ia64-gen.c:1545 #, c-format @@ -345,7 +347,7 @@ msgstr "opcode (mã thi hành) %s không có hạng (những tác tá»­ %d %d %d) #: ia64-gen.c:2816 #, c-format msgid "unable to change directory to \"%s\", errno = %s\n" -msgstr "không thay đổi được thÆ° mục thành \"%s\", số lá»—i = %s\n" +msgstr "không thể chuyển đổi thÆ° mục thành « %s », số lá»—i = %s\n" #. We've been passed a w. Return with an error message so that #. cgen will try the next parsing option. @@ -356,7 +358,7 @@ msgstr "Tá»­ khóa W không hợp lệ trong vị trí tác tá»­ FR." #. Invalid offset present. #: ip2k-asm.c:117 msgid "offset(IP) is not a valid form" -msgstr "offset(IP) (hiệu số) không là dạng hợp lệ" +msgstr "offset(IP) (hiệu số) không phải là dạng hợp lệ" #. Found something there in front of (DP) but it's out #. of range. @@ -381,15 +383,15 @@ msgstr "tác tá»­ ở ngoại phạm vị (không phải ở giữa số 1 và s #. Something is very wrong. opindex has to be one of the above. #: ip2k-asm.c:254 msgid "parse_addr16: invalid opindex." -msgstr "parse_addr16: (địa chỉ phân tách) opindex (chỉ mục loại tác tá»­) không hợp lệ." +msgstr "parse_addr16: (địa chỉ phân tách) opindex (chỉ mục kiểu tác tá»­) không hợp lệ." #: ip2k-asm.c:309 msgid "Byte address required. - must be even." -msgstr "Cần đến địa chỉ byte - phải là số chẵn." +msgstr "Cần đến địa chỉ byte — phải là số chẵn." #: ip2k-asm.c:318 msgid "cgen_parse_address returned a symbol. Literal required." -msgstr "cgen_parse_address (địa chỉ phân tách cgen) đã gá»i má»™t ký hiệu: còn cần đến hằng mã nguồn." +msgstr "cgen_parse_address (địa chỉ phân tách cgen) đã trả gởi má»™t ký hiệu: còn cần đến Ä‘iá»u nghÄ©a chữ." #: ip2k-asm.c:376 #, fuzzy, c-format @@ -415,22 +417,22 @@ msgstr "hiệu số 21-bit ở ngoại phạm vị" #: iq2000-asm.c:210 iq2000-asm.c:240 iq2000-asm.c:277 iq2000-asm.c:310 #: openrisc-asm.c:90 openrisc-asm.c:144 msgid "missing `)'" -msgstr "thiếu `)'" +msgstr "thiếu dấu ngoặc đóng « ) »" #: m10200-dis.c:199 #, c-format msgid "unknown\t0x%02x" -msgstr "không biết\t0x%02x" +msgstr "\t0x%02x không rõ" #: m10200-dis.c:339 #, c-format msgid "unknown\t0x%04lx" -msgstr "không biết\t0x%04lx" +msgstr "\t0x%04lx không rõ" #: m10300-dis.c:767 #, c-format msgid "unknown\t0x%04x" -msgstr "không biết\t0x%04x" +msgstr "\t0x%04x không rõ" #: m68k-dis.c:295 #, c-format @@ -552,7 +554,7 @@ msgid "" " " msgstr "" "\n" -" Vá»›i những tùy chá»n ở trên, há»— trợ những giá trị theo đây cho \"ABI\":\n" +" Vá»›i những tùy chá»n ở trên, há»— trợ những giá trị theo đây cho « ABI »:\n" " " #: mips-dis.c:1840 mips-dis.c:1848 mips-dis.c:1850 @@ -568,27 +570,27 @@ msgid "" " " msgstr "" "\n" -" Vá»›i những tùy chá»n ở trên, há»— trợ những giá trị theo đây cho \"ARCH\":\n" +" Vá»›i những tùy chá»n ở trên, há»— trợ những giá trị theo đây cho « ARCH »:\n" " " #: mmix-dis.c:34 #, c-format msgid "Bad case %d (%s) in %s:%d\n" -msgstr "TrÆ°á»ng hợp sai %d (%s) trong %s:%d\n" +msgstr "Chữ hoa/thÆ°á»ng sai %d (%s) trong %s:%d\n" #: mmix-dis.c:44 #, c-format msgid "Internal: Non-debugged code (test-case missing): %s:%d" -msgstr "Ná»™i bá»™: chÆ°a gỡ lá»—i mã (thiếu trÆ°á»ng hợp thá»­): %s:%d" +msgstr "Ná»™i bá»™ : chÆ°a gỡ lá»—i mã (thiếu trÆ°á»ng hợp thá»­): %s:%d" #: mmix-dis.c:53 msgid "(unknown)" -msgstr "(không biết)" +msgstr "(không rõ)" #: mmix-dis.c:519 #, c-format msgid "*unknown operands type: %d*" -msgstr "*không biết loại tác tá»­: %d*" +msgstr "• không biết kiểu tác tá»­: %d •" #. I and Z are output operands and can`t be immediate #. * A is an address and we can`t have the address of @@ -603,11 +605,11 @@ msgstr "$" #: ppc-opc.c:794 ppc-opc.c:822 msgid "invalid conditional option" -msgstr "tùy chá»n thuá»™c Ä‘iá»u kiện không hợp lệ" +msgstr "tùy chá»n Ä‘iá»u kiện không hợp lệ" #: ppc-opc.c:824 msgid "attempt to set y bit when using + or - modifier" -msgstr "cố lập «bit y» khi sá»­ dụng Ä‘iá»u sá»­a đổi + hay -" +msgstr "cố lập « bit y » khi sá»­ dụng Ä‘iá»u sá»­a đổi + hay -" #: ppc-opc.c:852 msgid "offset not a multiple of 16" @@ -663,15 +665,15 @@ msgstr "không cho phép mặt nặ bit" #: ppc-opc.c:1205 msgid "value out of range" -msgstr "giá trị cành ở ngoại phạm vị" +msgstr "giá trị ở ngoại phạm vị" #: ppc-opc.c:1273 msgid "index register in load range" -msgstr "thanh ghi cÆ¡ số trong phạm vị nạp" +msgstr "thanh ghi cÆ¡ số trong phạm vị tải" #: ppc-opc.c:1289 msgid "source and target register operands must be different" -msgstr "tác tá»­ thanh ghi cả hai loại nguồn và đích Ä‘á»u phải là khác nhau" +msgstr "tác tá»­ thanh ghi kiểu cả nguồn lẫn đích Ä‘á»u phải là khác nhau" #: ppc-opc.c:1304 msgid "invalid register operand when updating" @@ -688,27 +690,27 @@ msgstr "tác tá»­ thanh ghi nguồn phải là số chẵn" #. Mark as non-valid instruction. #: sparc-dis.c:760 msgid "unknown" -msgstr "không biết" +msgstr "không rõ" #: sparc-dis.c:835 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" -msgstr "Lá»—i ná»™i bá»™: sparc-opcode.h sai: \"%s\", %#.8lx, %#.8lx\n" +msgstr "Lá»—i ná»™i bá»™ : sparc-opcode.h sai: « %s », %#.8lx, %#.8lx\n" #: sparc-dis.c:846 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" -msgstr "Lá»—i ná»™i bá»™: sparc-opcode.h sai: \"%s\", %#.8lx, %#.8lx\n" +msgstr "Lá»—i ná»™i bá»™ : sparc-opcode.h sai: « %s », %#.8lx, %#.8lx\n" #: sparc-dis.c:895 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n" -msgstr "Lá»—i ná»™i bá»™: sparc-opcode.h sai: \"%s\" == \"%s\"\n" +msgstr "Lá»—i ná»™i bá»™ : sparc-opcode.h sai: « %s » == \"%s\"\n" #: v850-dis.c:225 #, c-format msgid "unknown operand shift: %x\n" -msgstr "không biết phím shift (bên trái hay bên phải) của tác tá»­: %x\n" +msgstr "không biết cách dịch tác tá»­: %x\n" #: v850-dis.c:237 #, c-format @@ -722,7 +724,7 @@ msgstr "không biết thanh ghi trong câu lệnh pop đống: %d\n" #. specific command line option is given to GAS. #: v850-opc.c:69 msgid "displacement value is not in range and is not aligned" -msgstr "giá trị di chuyển ở ngoại phạm vị và chÆ°a canh lá» nó" +msgstr "giá trị di chuyển ở ngoại phạm vị và chÆ°a được canh lá»" #: v850-opc.c:70 msgid "displacement value is out of range" @@ -738,7 +740,7 @@ msgstr "giá trị trá»±c tiếp ở ngoại phạm vị" #: v850-opc.c:84 msgid "branch value not in range and to odd offset" -msgstr "giá trị cành ở ngoại phạm vị và vá»›i hiệu số lẻ" +msgstr "giá trị cành ở ngoại phạm vị và đối vá»›i hiệu số lẻ" #: v850-opc.c:86 v850-opc.c:118 msgid "branch value out of range" @@ -746,11 +748,11 @@ msgstr "giá trị cành ở ngoại phạm vị" #: v850-opc.c:89 v850-opc.c:121 msgid "branch to odd offset" -msgstr "nhánh vá»›i hiệu số lẻ" +msgstr "nhánh đối vá»›i hiệu số lẻ" #: v850-opc.c:116 msgid "branch value not in range and to an odd offset" -msgstr "giá trị nhánh ở ngoại phạm vị và vá»›i hiệu số lẻ" +msgstr "giá trị nhánh ở ngoại phạm vị và đối vá»›i hiệu số lẻ" #: v850-opc.c:347 msgid "invalid register for stack adjustment" @@ -766,11 +768,11 @@ msgstr "giá trị trá»±c tiếp phải là số chẵn" #: xstormy16-asm.c:76 msgid "Bad register in preincrement" -msgstr "Thanh ghi sai trong Ä‘iá»u trÆ°á»›c lượng gia" +msgstr "Thanh ghi sai trong tiá»n lượng gia" #: xstormy16-asm.c:81 msgid "Bad register in postincrement" -msgstr "Thanh ghi sai trong Ä‘iá»u sau lượng gia" +msgstr "Thanh ghi sai trong hậu lượng gia" #: xstormy16-asm.c:83 msgid "Bad register name" @@ -782,7 +784,7 @@ msgstr "Nhãn xung Ä‘á»™t vá»›i tên thanh ghi" #: xstormy16-asm.c:91 msgid "Label conflicts with `Rx'" -msgstr "Nhãn xung Ä‘á»™t vá»›i `Rx'" +msgstr "Nhãn xung Ä‘á»™t vá»›i « Rx »" #: xstormy16-asm.c:93 msgid "Bad immediate expression" @@ -802,4 +804,4 @@ msgstr "Tác tá»­ không phải là má»™t ký hiệu" #: xstormy16-asm.c:172 msgid "Syntax error: No trailing ')'" -msgstr "Lá»—i cú pháp: không có ')' Ä‘i theo" +msgstr "Lá»—i cú pháp: không có dấu ngoặc đóng « ) » Ä‘i theo" diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb index 863beca..e956193 100644 --- a/readline/ChangeLog.gdb +++ b/readline/ChangeLog.gdb @@ -266,12 +266,17 @@ (insert_some_chars) [__MSDOS__]: Don't call tputs. (delete_chars) [__MSDOS__]: Don't call tputs. -2000-07-09 Elena Zannoni +2000-07-08 Elena Zannoni + + * readline/readline.h: Ifdef out the export of savestring(). + It should not have been in the distribution. + +2000-07-07 Elena Zannoni * Import of readline 4.1. Locally modified files: Makefile.in, configure.in, configure - (regenerated), config.h.in (regenerated), readline.h, rltty.c, + (regenerated), config.h.in (regenerated), rltty.c, shell.c signals.c. Locally added files: acconfig.h, config/*, config.h.bot, diff --git a/readline/NEWS b/readline/NEWS new file mode 100644 index 0000000..c5e67dc --- /dev/null +++ b/readline/NEWS @@ -0,0 +1,32 @@ +This is a terse description of the new features added to readline-5.1 since +the release of readline-5.0. + +1. New Features in Readline + +a. The key sequence sent by the keypad `delete' key is now automatically + bound to delete-char. + +b. A negative argument to menu-complete now cycles backward through the + completion list. + +c. A new bindable readline variable: bind-tty-special-chars. If non-zero, + readline will bind the terminal special characters to their readline + equivalents when it's called (on by default). + +d. New bindable command: vi-rubout. Saves deleted text for possible + reinsertion, as with any vi-mode `text modification' command; `X' is bound + to this in vi command mode. + +e. If the rl_completion_query_items is set to a value < 0, readline never + asks the user whether or not to view the possible completions. + +f. New application-callable auxiliary function, rl_variable_value, returns + a string corresponding to a readline variable's value. + +g. When parsing inputrc files and variable binding commands, the parser + strips trailing whitespace from values assigned to boolean variables + before checking them. + +h. A new external application-controllable variable that allows the LINES + and COLUMNS environment variables to set the window size regardless of + what the kernel returns. diff --git a/readline/configure b/readline/configure index b9cedcd..720d789 100755 --- a/readline/configure +++ b/readline/configure @@ -849,6 +849,10 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +<<<<<<< configure + --enable-shared build shared libraries [default=NO] +======= +>>>>>>> 1.6 --enable-static build static libraries [default=YES] Optional Packages: diff --git a/readline/doc/ChangeLog.gdb b/readline/doc/ChangeLog.gdb index 854d3ee..1253d9c 100644 --- a/readline/doc/ChangeLog.gdb +++ b/readline/doc/ChangeLog.gdb @@ -13,6 +13,10 @@ 2000-07-09 Elena Zannoni + * Removed generated files rluserman.{dvi, info, html, ps}. + +2000-07-07 Elena Zannoni + * Import of readline 4.1. Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for diff --git a/readline/doc/fdl.texi b/readline/doc/fdl.texi new file mode 100644 index 0000000..47ead9f --- /dev/null +++ b/readline/doc/fdl.texi @@ -0,0 +1,452 @@ + +@node GNU Free Documentation License +@appendixsec GNU Free Documentation License + +@cindex FDL, GNU Free Documentation License +@center Version 1.2, November 2002 + +@display +Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +@sc{ascii} without markup, Texinfo input format, La@TeX{} input +format, @acronym{SGML} or @acronym{XML} using a publicly available +@acronym{DTD}, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and +@acronym{JPG}. Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or +@acronym{XML} for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + +@item +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +@enumerate A +@item +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + +@item +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + +@item +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + +@item +Preserve all the copyright notices of the Document. + +@item +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + +@item +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + +@item +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + +@item +Include an unaltered copy of this License. + +@item +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + +@item +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + +@item +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + +@item +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + +@item +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + +@item +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + +@item +Preserve any Warranty Disclaimers. +@end enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +@uref{http://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. +@end enumerate + +@page +@appendixsubsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the ``with...Texts.'' line with this: + +@smallexample +@group + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. +@end group +@end smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@c Local Variables: +@c ispell-local-pdict: "ispell-dict" +@c End: + diff --git a/readline/doc/history.pdf b/readline/doc/history.pdf new file mode 100644 index 0000000..2ed10c4 Binary files /dev/null and b/readline/doc/history.pdf differ diff --git a/readline/doc/history.texi b/readline/doc/history.texi new file mode 100644 index 0000000..f6a3d20 --- /dev/null +++ b/readline/doc/history.texi @@ -0,0 +1,104 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header (This is for running Texinfo on a region.) +@setfilename history.info +@settitle GNU History Library +@c %**end of header (This is for running Texinfo on a region.) + +@setchapternewpage odd + +@include version.texi + +@copying +This document describes the GNU History library +(version @value{VERSION}, @value{UPDATED}), +a programming tool that provides a consistent user interface for +recalling lines of previously typed input. + +Copyright @copyright{} 1988-2004 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* History: (history). The GNU history library API. +@end direntry + +@titlepage +@title GNU History Library +@subtitle Edition @value{EDITION}, for @code{History Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page + +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU History Library + +This document describes the GNU History library, a programming tool that +provides a consistent user interface for recalling lines of previously +typed input. + +@menu +* Using History Interactively:: GNU History User's Manual. +* Programming with GNU History:: GNU History Programmer's Manual. +* Copying This Manual:: Copying This Manual. +* Concept Index:: Index of concepts described in this manual. +* Function and Variable Index:: Index of externally visible functions + and variables. +@end menu +@end ifnottex + +@syncodeindex fn vr + +@include hsuser.texi +@include hstech.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@node Concept Index +@appendix Concept Index +@printindex cp + +@node Function and Variable Index +@appendix Function and Variable Index +@printindex vr + +@bye diff --git a/readline/doc/hstech.texi b/readline/doc/hstech.texi new file mode 100644 index 0000000..4fdda5f --- /dev/null +++ b/readline/doc/hstech.texi @@ -0,0 +1,573 @@ +@ignore +This file documents the user interface to the GNU History library. + +Copyright (C) 1988-2002 Free Software Foundation, Inc. +Authored by Brian Fox and Chet Ramey. + +Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +GNU Copyright statement is available to the distributee, and provided that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end ignore + +@node Programming with GNU History +@chapter Programming with GNU History + +This chapter describes how to interface programs that you write +with the @sc{gnu} History Library. +It should be considered a technical guide. +For information on the interactive use of @sc{gnu} History, @pxref{Using +History Interactively}. + +@menu +* Introduction to History:: What is the GNU History library for? +* History Storage:: How information is stored. +* History Functions:: Functions that you can use. +* History Variables:: Variables that control behaviour. +* History Programming Example:: Example of using the GNU History Library. +@end menu + +@node Introduction to History +@section Introduction to History + +Many programs read input from the user a line at a time. The @sc{gnu} +History library is able to keep track of those lines, associate arbitrary +data with each line, and utilize information from previous lines in +composing new ones. + +The programmer using the History library has available functions +for remembering lines on a history list, associating arbitrary data +with a line, removing lines from the list, searching through the list +for a line containing an arbitrary text string, and referencing any line +in the list directly. In addition, a history @dfn{expansion} function +is available which provides for a consistent user interface across +different programs. + +The user using programs written with the History library has the +benefit of a consistent user interface with a set of well-known +commands for manipulating the text of previous lines and using that text +in new commands. The basic history manipulation commands are similar to +the history substitution provided by @code{csh}. + +If the programmer desires, he can use the Readline library, which +includes some history manipulation by default, and has the added +advantage of command line editing. + +Before declaring any functions using any functionality the History +library provides in other code, an application writer should include +the file @code{} in any file that uses the +History library's features. It supplies extern declarations for all +of the library's public functions and variables, and declares all of +the public data structures. + +@node History Storage +@section History Storage + +The history list is an array of history entries. A history entry is +declared as follows: + +@example +typedef void *histdata_t; + +typedef struct _hist_entry @{ + char *line; + char *timestamp; + histdata_t data; +@} HIST_ENTRY; +@end example + +The history list itself might therefore be declared as + +@example +HIST_ENTRY **the_history_list; +@end example + +The state of the History library is encapsulated into a single structure: + +@example +/* + * A structure used to pass around the current state of the history. + */ +typedef struct _hist_state @{ + HIST_ENTRY **entries; /* Pointer to the entries themselves. */ + int offset; /* The location pointer within this array. */ + int length; /* Number of elements within this array. */ + int size; /* Number of slots allocated to this array. */ + int flags; +@} HISTORY_STATE; +@end example + +If the flags member includes @code{HS_STIFLED}, the history has been +stifled. + +@node History Functions +@section History Functions + +This section describes the calling sequence for the various functions +exported by the @sc{gnu} History library. + +@menu +* Initializing History and State Management:: Functions to call when you + want to use history in a + program. +* History List Management:: Functions used to manage the list + of history entries. +* Information About the History List:: Functions returning information about + the history list. +* Moving Around the History List:: Functions used to change the position + in the history list. +* Searching the History List:: Functions to search the history list + for entries containing a string. +* Managing the History File:: Functions that read and write a file + containing the history list. +* History Expansion:: Functions to perform csh-like history + expansion. +@end menu + +@node Initializing History and State Management +@subsection Initializing History and State Management + +This section describes functions used to initialize and manage +the state of the History library when you want to use the history +functions in your program. + +@deftypefun void using_history (void) +Begin a session in which the history functions might be used. This +initializes the interactive variables. +@end deftypefun + +@deftypefun {HISTORY_STATE *} history_get_history_state (void) +Return a structure describing the current state of the input history. +@end deftypefun + +@deftypefun void history_set_history_state (HISTORY_STATE *state) +Set the state of the history list according to @var{state}. +@end deftypefun + +@node History List Management +@subsection History List Management + +These functions manage individual entries on the history list, or set +parameters managing the list itself. + +@deftypefun void add_history (const char *string) +Place @var{string} at the end of the history list. The associated data +field (if any) is set to @code{NULL}. +@end deftypefun + +@deftypefun void add_history_time (const char *string) +Change the time stamp associated with the most recent history entry to +@var{string}. +@end deftypefun + +@deftypefun {HIST_ENTRY *} remove_history (int which) +Remove history entry at offset @var{which} from the history. The +removed element is returned so you can free the line, data, +and containing structure. +@end deftypefun + +@deftypefun {histdata_t} free_history_entry (HIST_ENTRY *histent) +Free the history entry @var{histent} and any history library private +data associated with it. Returns the application-specific data +so the caller can dispose of it. +@end deftypefun + +@deftypefun {HIST_ENTRY *} replace_history_entry (int which, const char *line, histdata_t data) +Make the history entry at offset @var{which} have @var{line} and @var{data}. +This returns the old entry so the caller can dispose of any +application-specific data. In the case +of an invalid @var{which}, a @code{NULL} pointer is returned. +@end deftypefun + +@deftypefun void clear_history (void) +Clear the history list by deleting all the entries. +@end deftypefun + +@deftypefun void stifle_history (int max) +Stifle the history list, remembering only the last @var{max} entries. +@end deftypefun + +@deftypefun int unstifle_history (void) +Stop stifling the history. This returns the previously-set +maximum number of history entries (as set by @code{stifle_history()}). +The value is positive if the history was +stifled, negative if it wasn't. +@end deftypefun + +@deftypefun int history_is_stifled (void) +Returns non-zero if the history is stifled, zero if it is not. +@end deftypefun + +@node Information About the History List +@subsection Information About the History List + +These functions return information about the entire history list or +individual list entries. + +@deftypefun {HIST_ENTRY **} history_list (void) +Return a @code{NULL} terminated array of @code{HIST_ENTRY *} which is the +current input history. Element 0 of this list is the beginning of time. +If there is no history, return @code{NULL}. +@end deftypefun + +@deftypefun int where_history (void) +Returns the offset of the current history element. +@end deftypefun + +@deftypefun {HIST_ENTRY *} current_history (void) +Return the history entry at the current position, as determined by +@code{where_history()}. If there is no entry there, return a @code{NULL} +pointer. +@end deftypefun + +@deftypefun {HIST_ENTRY *} history_get (int offset) +Return the history entry at position @var{offset}, starting from +@code{history_base} (@pxref{History Variables}). +If there is no entry there, or if @var{offset} +is greater than the history length, return a @code{NULL} pointer. +@end deftypefun + +@deftypefun time_t history_get_time (HIST_ENTRY *entry) +Return the time stamp associated with the history entry @var{entry}. +@end deftypefun + +@deftypefun int history_total_bytes (void) +Return the number of bytes that the primary history entries are using. +This function returns the sum of the lengths of all the lines in the +history. +@end deftypefun + +@node Moving Around the History List +@subsection Moving Around the History List + +These functions allow the current index into the history list to be +set or changed. + +@deftypefun int history_set_pos (int pos) +Set the current history offset to @var{pos}, an absolute index +into the list. +Returns 1 on success, 0 if @var{pos} is less than zero or greater +than the number of history entries. +@end deftypefun + +@deftypefun {HIST_ENTRY *} previous_history (void) +Back up the current history offset to the previous history entry, and +return a pointer to that entry. If there is no previous entry, return +a @code{NULL} pointer. +@end deftypefun + +@deftypefun {HIST_ENTRY *} next_history (void) +Move the current history offset forward to the next history entry, and +return the a pointer to that entry. If there is no next entry, return +a @code{NULL} pointer. +@end deftypefun + +@node Searching the History List +@subsection Searching the History List +@cindex History Searching + +These functions allow searching of the history list for entries containing +a specific string. Searching may be performed both forward and backward +from the current history position. The search may be @dfn{anchored}, +meaning that the string must match at the beginning of the history entry. +@cindex anchored search + +@deftypefun int history_search (const char *string, int direction) +Search the history for @var{string}, starting at the current history offset. +If @var{direction} is less than 0, then the search is through +previous entries, otherwise through subsequent entries. +If @var{string} is found, then +the current history index is set to that history entry, and the value +returned is the offset in the line of the entry where +@var{string} was found. Otherwise, nothing is changed, and a -1 is +returned. +@end deftypefun + +@deftypefun int history_search_prefix (const char *string, int direction) +Search the history for @var{string}, starting at the current history +offset. The search is anchored: matching lines must begin with +@var{string}. If @var{direction} is less than 0, then the search is +through previous entries, otherwise through subsequent entries. +If @var{string} is found, then the +current history index is set to that entry, and the return value is 0. +Otherwise, nothing is changed, and a -1 is returned. +@end deftypefun + +@deftypefun int history_search_pos (const char *string, int direction, int pos) +Search for @var{string} in the history list, starting at @var{pos}, an +absolute index into the list. If @var{direction} is negative, the search +proceeds backward from @var{pos}, otherwise forward. Returns the absolute +index of the history element where @var{string} was found, or -1 otherwise. +@end deftypefun + +@node Managing the History File +@subsection Managing the History File + +The History library can read the history from and write it to a file. +This section documents the functions for managing a history file. + +@deftypefun int read_history (const char *filename) +Add the contents of @var{filename} to the history list, a line at a time. +If @var{filename} is @code{NULL}, then read from @file{~/.history}. +Returns 0 if successful, or @code{errno} if not. +@end deftypefun + +@deftypefun int read_history_range (const char *filename, int from, int to) +Read a range of lines from @var{filename}, adding them to the history list. +Start reading at line @var{from} and end at @var{to}. +If @var{from} is zero, start at the beginning. If @var{to} is less than +@var{from}, then read until the end of the file. If @var{filename} is +@code{NULL}, then read from @file{~/.history}. Returns 0 if successful, +or @code{errno} if not. +@end deftypefun + +@deftypefun int write_history (const char *filename) +Write the current history to @var{filename}, overwriting @var{filename} +if necessary. +If @var{filename} is @code{NULL}, then write the history list to +@file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. +@end deftypefun + +@deftypefun int append_history (int nelements, const char *filename) +Append the last @var{nelements} of the history list to @var{filename}. +If @var{filename} is @code{NULL}, then append to @file{~/.history}. +Returns 0 on success, or @code{errno} on a read or write error. +@end deftypefun + +@deftypefun int history_truncate_file (const char *filename, int nlines) +Truncate the history file @var{filename}, leaving only the last +@var{nlines} lines. +If @var{filename} is @code{NULL}, then @file{~/.history} is truncated. +Returns 0 on success, or @code{errno} on failure. +@end deftypefun + +@node History Expansion +@subsection History Expansion + +These functions implement history expansion. + +@deftypefun int history_expand (char *string, char **output) +Expand @var{string}, placing the result into @var{output}, a pointer +to a string (@pxref{History Interaction}). Returns: +@table @code +@item 0 +If no expansions took place (or, if the only change in +the text was the removal of escape characters preceding the history expansion +character); +@item 1 +if expansions did take place; +@item -1 +if there was an error in expansion; +@item 2 +if the returned line should be displayed, but not executed, +as with the @code{:p} modifier (@pxref{Modifiers}). +@end table + +If an error ocurred in expansion, then @var{output} contains a descriptive +error message. +@end deftypefun + +@deftypefun {char *} get_history_event (const char *string, int *cindex, int qchar) +Returns the text of the history event beginning at @var{string} + +@var{*cindex}. @var{*cindex} is modified to point to after the event +specifier. At function entry, @var{cindex} points to the index into +@var{string} where the history event specification begins. @var{qchar} +is a character that is allowed to end the event specification in addition +to the ``normal'' terminating characters. +@end deftypefun + +@deftypefun {char **} history_tokenize (const char *string) +Return an array of tokens parsed out of @var{string}, much as the +shell might. The tokens are split on the characters in the +@var{history_word_delimiters} variable, +and shell quoting conventions are obeyed. +@end deftypefun + +@deftypefun {char *} history_arg_extract (int first, int last, const char *string) +Extract a string segment consisting of the @var{first} through @var{last} +arguments present in @var{string}. Arguments are split using +@code{history_tokenize}. +@end deftypefun + +@node History Variables +@section History Variables + +This section describes the externally-visible variables exported by +the @sc{gnu} History Library. + +@deftypevar int history_base +The logical offset of the first entry in the history list. +@end deftypevar + +@deftypevar int history_length +The number of entries currently stored in the history list. +@end deftypevar + +@deftypevar int history_max_entries +The maximum number of history entries. This must be changed using +@code{stifle_history()}. +@end deftypevar + +@deftypevar int history_write_timestamps +If non-zero, timestamps are written to the history file, so they can be +preserved between sessions. The default value is 0, meaning that +timestamps are not saved. +@end deftypevar + +@deftypevar char history_expansion_char +The character that introduces a history event. The default is @samp{!}. +Setting this to 0 inhibits history expansion. +@end deftypevar + +@deftypevar char history_subst_char +The character that invokes word substitution if found at the start of +a line. The default is @samp{^}. +@end deftypevar + +@deftypevar char history_comment_char +During tokenization, if this character is seen as the first character +of a word, then it and all subsequent characters up to a newline are +ignored, suppressing history expansion for the remainder of the line. +This is disabled by default. +@end deftypevar + +@deftypevar {char *} history_word_delimiters +The characters that separate tokens for @code{history_tokenize()}. +The default value is @code{" \t\n()<>;&|"}. +@end deftypevar + +@deftypevar {char *} history_search_delimiter_chars +The list of additional characters which can delimit a history search +string, in addition to space, TAB, @samp{:} and @samp{?} in the case of +a substring search. The default is empty. +@end deftypevar + +@deftypevar {char *} history_no_expand_chars +The list of characters which inhibit history expansion if found immediately +following @var{history_expansion_char}. The default is space, tab, newline, +carriage return, and @samp{=}. +@end deftypevar + +@deftypevar int history_quotes_inhibit_expansion +If non-zero, single-quoted words are not scanned for the history expansion +character. The default value is 0. +@end deftypevar + +@deftypevar {rl_linebuf_func_t *} history_inhibit_expansion_function +This should be set to the address of a function that takes two arguments: +a @code{char *} (@var{string}) +and an @code{int} index into that string (@var{i}). +It should return a non-zero value if the history expansion starting at +@var{string[i]} should not be performed; zero if the expansion should +be done. +It is intended for use by applications like Bash that use the history +expansion character for additional purposes. +By default, this variable is set to @code{NULL}. +@end deftypevar + +@node History Programming Example +@section History Programming Example + +The following program demonstrates simple use of the @sc{gnu} History Library. + +@smallexample +#include +#include + +main (argc, argv) + int argc; + char **argv; +@{ + char line[1024], *t; + int len, done = 0; + + line[0] = 0; + + using_history (); + while (!done) + @{ + printf ("history$ "); + fflush (stdout); + t = fgets (line, sizeof (line) - 1, stdin); + if (t && *t) + @{ + len = strlen (t); + if (t[len - 1] == '\n') + t[len - 1] = '\0'; + @} + + if (!t) + strcpy (line, "quit"); + + if (line[0]) + @{ + char *expansion; + int result; + + result = history_expand (line, &expansion); + if (result) + fprintf (stderr, "%s\n", expansion); + + if (result < 0 || result == 2) + @{ + free (expansion); + continue; + @} + + add_history (expansion); + strncpy (line, expansion, sizeof (line) - 1); + free (expansion); + @} + + if (strcmp (line, "quit") == 0) + done = 1; + else if (strcmp (line, "save") == 0) + write_history ("history_file"); + else if (strcmp (line, "read") == 0) + read_history ("history_file"); + else if (strcmp (line, "list") == 0) + @{ + register HIST_ENTRY **the_list; + register int i; + + the_list = history_list (); + if (the_list) + for (i = 0; the_list[i]; i++) + printf ("%d: %s\n", i + history_base, the_list[i]->line); + @} + else if (strncmp (line, "delete", 6) == 0) + @{ + int which; + if ((sscanf (line + 6, "%d", &which)) == 1) + @{ + HIST_ENTRY *entry = remove_history (which); + if (!entry) + fprintf (stderr, "No such entry %d\n", which); + else + @{ + free (entry->line); + free (entry); + @} + @} + else + @{ + fprintf (stderr, "non-numeric arg given to `delete'\n"); + @} + @} + @} +@} +@end smallexample diff --git a/readline/doc/hsuser.texi b/readline/doc/hsuser.texi new file mode 100644 index 0000000..6c89183 --- /dev/null +++ b/readline/doc/hsuser.texi @@ -0,0 +1,457 @@ +@ignore +This file documents the user interface to the GNU History library. + +Copyright (C) 1988-2002 Free Software Foundation, Inc. +Authored by Brian Fox and Chet Ramey. + +Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +GNU Copyright statement is available to the distributee, and provided that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end ignore + +@node Using History Interactively +@chapter Using History Interactively + +@ifclear BashFeatures +@defcodeindex bt +@end ifclear + +@ifset BashFeatures +This chapter describes how to use the @sc{gnu} History Library +interactively, from a user's standpoint. +It should be considered a user's guide. +For information on using the @sc{gnu} History Library in other programs, +see the @sc{gnu} Readline Library Manual. +@end ifset +@ifclear BashFeatures +This chapter describes how to use the @sc{gnu} History Library interactively, +from a user's standpoint. It should be considered a user's guide. For +information on using the @sc{gnu} History Library in your own programs, +@pxref{Programming with GNU History}. +@end ifclear + +@ifset BashFeatures +@menu +* Bash History Facilities:: How Bash lets you manipulate your command + history. +* Bash History Builtins:: The Bash builtin commands that manipulate + the command history. +* History Interaction:: What it feels like using History as a user. +@end menu +@end ifset +@ifclear BashFeatures +@menu +* History Interaction:: What it feels like using History as a user. +@end menu +@end ifclear + +@ifset BashFeatures +@node Bash History Facilities +@section Bash History Facilities +@cindex command history +@cindex history list + +When the @option{-o history} option to the @code{set} builtin +is enabled (@pxref{The Set Builtin}), +the shell provides access to the @dfn{command history}, +the list of commands previously typed. +The value of the @env{HISTSIZE} shell variable is used as the +number of commands to save in a history list. +The text of the last @env{$HISTSIZE} +commands (default 500) is saved. +The shell stores each command in the history list prior to +parameter and variable expansion +but after history expansion is performed, subject to the +values of the shell variables +@env{HISTIGNORE} and @env{HISTCONTROL}. + +When the shell starts up, the history is initialized from the +file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). +The file named by the value of @env{HISTFILE} is truncated, if +necessary, to contain no more than the number of lines specified by +the value of the @env{HISTFILESIZE} variable. +When an interactive shell exits, the last +@env{$HISTSIZE} lines are copied from the history list to the file +named by @env{$HISTFILE}. +If the @code{histappend} shell option is set (@pxref{Bash Builtins}), +the lines are appended to the history file, +otherwise the history file is overwritten. +If @env{HISTFILE} +is unset, or if the history file is unwritable, the history is +not saved. After saving the history, the history file is truncated +to contain no more than @env{$HISTFILESIZE} +lines. If @env{HISTFILESIZE} is not set, no truncation is performed. + +If the @env{HISTTIMEFORMAT} is set, the time stamp information +associated with each history entry is written to the history file. + +The builtin command @code{fc} may be used to list or edit and re-execute +a portion of the history list. +The @code{history} builtin may be used to display or modify the history +list and manipulate the history file. +When using command-line editing, search commands +are available in each editing mode that provide access to the +history list (@pxref{Commands For History}). + +The shell allows control over which commands are saved on the history +list. The @env{HISTCONTROL} and @env{HISTIGNORE} +variables may be set to cause the shell to save only a subset of the +commands entered. +The @code{cmdhist} +shell option, if enabled, causes the shell to attempt to save each +line of a multi-line command in the same history entry, adding +semicolons where necessary to preserve syntactic correctness. +The @code{lithist} +shell option causes the shell to save the command with embedded newlines +instead of semicolons. +The @code{shopt} builtin is used to set these options. +@xref{Bash Builtins}, for a description of @code{shopt}. + +@node Bash History Builtins +@section Bash History Builtins +@cindex history builtins + +Bash provides two builtin commands which manipulate the +history list and history file. + +@table @code + +@item fc +@btindex fc +@example +@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]} +@code{fc -s [@var{pat}=@var{rep}] [@var{command}]} +@end example + +Fix Command. In the first form, a range of commands from @var{first} to +@var{last} is selected from the history list. Both @var{first} and +@var{last} may be specified as a string (to locate the most recent +command beginning with that string) or as a number (an index into the +history list, where a negative number is used as an offset from the +current command number). If @var{last} is not specified it is set to +@var{first}. If @var{first} is not specified it is set to the previous +command for editing and @minus{}16 for listing. If the @option{-l} flag is +given, the commands are listed on standard output. The @option{-n} flag +suppresses the command numbers when listing. The @option{-r} flag +reverses the order of the listing. Otherwise, the editor given by +@var{ename} is invoked on a file containing those commands. If +@var{ename} is not given, the value of the following variable expansion +is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the +value of the @env{FCEDIT} variable if set, or the value of the +@env{EDITOR} variable if that is set, or @code{vi} if neither is set. +When editing is complete, the edited commands are echoed and executed. + +In the second form, @var{command} is re-executed after each instance +of @var{pat} in the selected command is replaced by @var{rep}. + +A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so +that typing @samp{r cc} runs the last command beginning with @code{cc} +and typing @samp{r} re-executes the last command (@pxref{Aliases}). + +@item history +@btindex history +@example +history [@var{n}] +history -c +history -d @var{offset} +history [-anrw] [@var{filename}] +history -ps @var{arg} +@end example + +With no options, display the history list with line numbers. +Lines prefixed with a @samp{*} have been modified. +An argument of @var{n} lists only the last @var{n} lines. +If the shell variable @env{HISTTIMEFORMAT} is set and not null, +it is used as a format string for @var{strftime} to display +the time stamp associated with each displayed history entry. +No intervening blank is printed between the formatted time stamp +and the history line. + +Options, if supplied, have the following meanings: + +@table @code +@item -c +Clear the history list. This may be combined +with the other options to replace the history list completely. + +@item -d @var{offset} +Delete the history entry at position @var{offset}. +@var{offset} should be specified as it appears when the history is +displayed. + +@item -a +Append the new +history lines (history lines entered since the beginning of the +current Bash session) to the history file. + +@item -n +Append the history lines not already read from the history file +to the current history list. These are lines appended to the history +file since the beginning of the current Bash session. + +@item -r +Read the current history file and append its contents to +the history list. + +@item -w +Write out the current history to the history file. + +@item -p +Perform history substitution on the @var{arg}s and display the result +on the standard output, without storing the results in the history list. + +@item -s +The @var{arg}s are added to the end of +the history list as a single entry. + +@end table + +When any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is +used, if @var{filename} +is given, then it is used as the history file. If not, then +the value of the @env{HISTFILE} variable is used. + +@end table +@end ifset + +@node History Interaction +@section History Expansion +@cindex history expansion + +The History library provides a history expansion feature that is similar +to the history expansion provided by @code{csh}. This section +describes the syntax used to manipulate the history information. + +History expansions introduce words from the history list into +the input stream, making it easy to repeat commands, insert the +arguments to a previous command into the current input line, or +fix errors in previous commands quickly. + +History expansion takes place in two parts. The first is to determine +which line from the history list should be used during substitution. +The second is to select portions of that line for inclusion into the +current one. The line selected from the history is called the +@dfn{event}, and the portions of that line that are acted upon are +called @dfn{words}. Various @dfn{modifiers} are available to manipulate +the selected words. The line is broken into words in the same fashion +that Bash does, so that several words +surrounded by quotes are considered one word. +History expansions are introduced by the appearance of the +history expansion character, which is @samp{!} by default. +@ifset BashFeatures +Only @samp{\} and @samp{'} may be used to escape the history expansion +character. +@end ifset + +@ifset BashFeatures +Several shell options settable with the @code{shopt} +builtin (@pxref{Bash Builtins}) may be used to tailor +the behavior of history expansion. If the +@code{histverify} shell option is enabled, and Readline +is being used, history substitutions are not immediately passed to +the shell parser. +Instead, the expanded line is reloaded into the Readline +editing buffer for further modification. +If Readline is being used, and the @code{histreedit} +shell option is enabled, a failed history expansion will be +reloaded into the Readline editing buffer for correction. +The @option{-p} option to the @code{history} builtin command +may be used to see what a history expansion will do before using it. +The @option{-s} option to the @code{history} builtin may be used to +add commands to the end of the history list without actually executing +them, so that they are available for subsequent recall. +This is most useful in conjunction with Readline. + +The shell allows control of the various characters used by the +history expansion mechanism with the @code{histchars} variable. +@end ifset + +@menu +* Event Designators:: How to specify which history line to use. +* Word Designators:: Specifying which words are of interest. +* Modifiers:: Modifying the results of substitution. +@end menu + +@node Event Designators +@subsection Event Designators +@cindex event designators + +An event designator is a reference to a command line entry in the +history list. +@cindex history events + +@table @asis + +@item @code{!} +@ifset BashFeatures +Start a history substitution, except when followed by a space, tab, +the end of the line, @samp{=} or @samp{(} (when the +@code{extglob} shell option is enabled using the @code{shopt} builtin). +@end ifset +@ifclear BashFeatures +Start a history substitution, except when followed by a space, tab, +the end of the line, or @samp{=}. +@end ifclear + +@item @code{!@var{n}} +Refer to command line @var{n}. + +@item @code{!-@var{n}} +Refer to the command @var{n} lines back. + +@item @code{!!} +Refer to the previous command. This is a synonym for @samp{!-1}. + +@item @code{!@var{string}} +Refer to the most recent command starting with @var{string}. + +@item @code{!?@var{string}[?]} +Refer to the most recent command containing @var{string}. The trailing +@samp{?} may be omitted if the @var{string} is followed immediately by +a newline. + +@item @code{^@var{string1}^@var{string2}^} +Quick Substitution. Repeat the last command, replacing @var{string1} +with @var{string2}. Equivalent to +@code{!!:s/@var{string1}/@var{string2}/}. + +@item @code{!#} +The entire command line typed so far. + +@end table + +@node Word Designators +@subsection Word Designators + +Word designators are used to select desired words from the event. +A @samp{:} separates the event specification from the word designator. It +may be omitted if the word designator begins with a @samp{^}, @samp{$}, +@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning +of the line, with the first word being denoted by 0 (zero). Words are +inserted into the current line separated by single spaces. + +@need 0.75 +For example, + +@table @code +@item !! +designates the preceding command. When you type this, the preceding +command is repeated in toto. + +@item !!:$ +designates the last argument of the preceding command. This may be +shortened to @code{!$}. + +@item !fi:2 +designates the second argument of the most recent command starting with +the letters @code{fi}. +@end table + +@need 0.75 +Here are the word designators: + +@table @code + +@item 0 (zero) +The @code{0}th word. For many applications, this is the command word. + +@item @var{n} +The @var{n}th word. + +@item ^ +The first argument; that is, word 1. + +@item $ +The last argument. + +@item % +The word matched by the most recent @samp{?@var{string}?} search. + +@item @var{x}-@var{y} +A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}. + +@item * +All of the words, except the @code{0}th. This is a synonym for @samp{1-$}. +It is not an error to use @samp{*} if there is just one word in the event; +the empty string is returned in that case. + +@item @var{x}* +Abbreviates @samp{@var{x}-$} + +@item @var{x}- +Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word. + +@end table + +If a word designator is supplied without an event specification, the +previous command is used as the event. + +@node Modifiers +@subsection Modifiers + +After the optional word designator, you can add a sequence of one or more +of the following modifiers, each preceded by a @samp{:}. + +@table @code + +@item h +Remove a trailing pathname component, leaving only the head. + +@item t +Remove all leading pathname components, leaving the tail. + +@item r +Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving +the basename. + +@item e +Remove all but the trailing suffix. + +@item p +Print the new command but do not execute it. + +@ifset BashFeatures +@item q +Quote the substituted words, escaping further substitutions. + +@item x +Quote the substituted words as with @samp{q}, +but break into words at spaces, tabs, and newlines. +@end ifset + +@item s/@var{old}/@var{new}/ +Substitute @var{new} for the first occurrence of @var{old} in the +event line. Any delimiter may be used in place of @samp{/}. +The delimiter may be quoted in @var{old} and @var{new} +with a single backslash. If @samp{&} appears in @var{new}, +it is replaced by @var{old}. A single backslash will quote +the @samp{&}. The final delimiter is optional if it is the last +character on the input line. + +@item & +Repeat the previous substitution. + +@item g +@itemx a +Cause changes to be applied over the entire event line. Used in +conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/}, +or with @samp{&}. + +@item G +Apply the following @samp{s} modifier once to each word in the event. + +@end table diff --git a/readline/doc/readline.pdf b/readline/doc/readline.pdf new file mode 100644 index 0000000..7fc2dfe Binary files /dev/null and b/readline/doc/readline.pdf differ diff --git a/readline/doc/rlman.texi b/readline/doc/rlman.texi new file mode 100644 index 0000000..f834b58 --- /dev/null +++ b/readline/doc/rlman.texi @@ -0,0 +1,101 @@ +\input texinfo @c -*-texinfo-*- +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename readline.info +@settitle GNU Readline Library +@comment %**end of header (This is for running Texinfo on a region.) +@synindex vr fn +@setchapternewpage odd + +@include version.texi + +@copying +This manual describes the GNU Readline Library +(version @value{VERSION}, @value{UPDATED}), a library which aids in the +consistency of user interface across discrete programs which provide +a command line interface. + +Copyright @copyright{} 1988-2004 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* Readline: (readline). The GNU readline library API. +@end direntry + +@titlepage +@title GNU Readline Library +@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU Readline Library + +This document describes the GNU Readline Library, a utility which aids +in the consistency of user interface across discrete programs which +provide a command line interface. + +@menu +* Command Line Editing:: GNU Readline User's Manual. +* Programming with GNU Readline:: GNU Readline Programmer's Manual. +* Copying This Manual:: Copying this manual. +* Concept Index:: Index of concepts described in this manual. +* Function and Variable Index:: Index of externally visible functions + and variables. +@end menu +@end ifnottex + +@include rluser.texi +@include rltech.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@node Concept Index +@unnumbered Concept Index +@printindex cp + +@node Function and Variable Index +@unnumbered Function and Variable Index +@printindex fn + +@bye diff --git a/readline/doc/rltech.texi b/readline/doc/rltech.texi new file mode 100644 index 0000000..6f2e2ee --- /dev/null +++ b/readline/doc/rltech.texi @@ -0,0 +1,2285 @@ +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rltech.info +@comment %**end of header (This is for running Texinfo on a region.) +@setchapternewpage odd + +@ifinfo +This document describes the GNU Readline Library, a utility for aiding +in the consistency of user interface across discrete programs that need +to provide a command line interface. + +Copyright (C) 1988-2005 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +pare preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). +@end ignore + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Foundation. +@end ifinfo + +@node Programming with GNU Readline +@chapter Programming with GNU Readline + +This chapter describes the interface between the @sc{gnu} Readline Library and +other programs. If you are a programmer, and you wish to include the +features found in @sc{gnu} Readline +such as completion, line editing, and interactive history manipulation +in your own programs, this section is for you. + +@menu +* Basic Behavior:: Using the default behavior of Readline. +* Custom Functions:: Adding your own functions to Readline. +* Readline Variables:: Variables accessible to custom + functions. +* Readline Convenience Functions:: Functions which Readline supplies to + aid in writing your own custom + functions. +* Readline Signal Handling:: How Readline behaves when it receives signals. +* Custom Completers:: Supplanting or supplementing Readline's + completion functions. +@end menu + +@node Basic Behavior +@section Basic Behavior + +Many programs provide a command line interface, such as @code{mail}, +@code{ftp}, and @code{sh}. For such programs, the default behaviour of +Readline is sufficient. This section describes how to use Readline in +the simplest way possible, perhaps to replace calls in your code to +@code{gets()} or @code{fgets()}. + +@findex readline +@cindex readline, function + +The function @code{readline()} prints a prompt @var{prompt} +and then reads and returns a single line of text from the user. +If @var{prompt} is @code{NULL} or the empty string, no prompt is displayed. +The line @code{readline} returns is allocated with @code{malloc()}; +the caller should @code{free()} the line when it has finished with it. +The declaration for @code{readline} in ANSI C is + +@example +@code{char *readline (const char *@var{prompt});} +@end example + +@noindent +So, one might say +@example +@code{char *line = readline ("Enter a line: ");} +@end example +@noindent +in order to read a line of text from the user. +The line returned has the final newline removed, so only the +text remains. + +If @code{readline} encounters an @code{EOF} while reading the line, and the +line is empty at that point, then @code{(char *)NULL} is returned. +Otherwise, the line is ended just as if a newline had been typed. + +If you want the user to be able to get at the line later, (with +@key{C-p} for example), you must call @code{add_history()} to save the +line away in a @dfn{history} list of such lines. + +@example +@code{add_history (line)}; +@end example + +@noindent +For full details on the GNU History Library, see the associated manual. + +It is preferable to avoid saving empty lines on the history list, since +users rarely have a burning need to reuse a blank line. Here is +a function which usefully replaces the standard @code{gets()} library +function, and has the advantage of no static buffer to overflow: + +@example +/* A static variable for holding the line. */ +static char *line_read = (char *)NULL; + +/* Read a string, and return a pointer to it. + Returns NULL on EOF. */ +char * +rl_gets () +@{ + /* If the buffer has already been allocated, + return the memory to the free pool. */ + if (line_read) + @{ + free (line_read); + line_read = (char *)NULL; + @} + + /* Get a line from the user. */ + line_read = readline (""); + + /* If the line has any text in it, + save it on the history. */ + if (line_read && *line_read) + add_history (line_read); + + return (line_read); +@} +@end example + +This function gives the user the default behaviour of @key{TAB} +completion: completion on file names. If you do not want Readline to +complete on filenames, you can change the binding of the @key{TAB} key +with @code{rl_bind_key()}. + +@example +@code{int rl_bind_key (int @var{key}, rl_command_func_t *@var{function});} +@end example + +@code{rl_bind_key()} takes two arguments: @var{key} is the character that +you want to bind, and @var{function} is the address of the function to +call when @var{key} is pressed. Binding @key{TAB} to @code{rl_insert()} +makes @key{TAB} insert itself. +@code{rl_bind_key()} returns non-zero if @var{key} is not a valid +ASCII character code (between 0 and 255). + +Thus, to disable the default @key{TAB} behavior, the following suffices: +@example +@code{rl_bind_key ('\t', rl_insert);} +@end example + +This code should be executed once at the start of your program; you +might write a function called @code{initialize_readline()} which +performs this and other desired initializations, such as installing +custom completers (@pxref{Custom Completers}). + +@node Custom Functions +@section Custom Functions + +Readline provides many functions for manipulating the text of +the line, but it isn't possible to anticipate the needs of all +programs. This section describes the various functions and variables +defined within the Readline library which allow a user program to add +customized functionality to Readline. + +Before declaring any functions that customize Readline's behavior, or +using any functionality Readline provides in other code, an +application writer should include the file @code{} +in any file that uses Readline's features. Since some of the definitions +in @code{readline.h} use the @code{stdio} library, the file +@code{} should be included before @code{readline.h}. + +@code{readline.h} defines a C preprocessor variable that should +be treated as an integer, @code{RL_READLINE_VERSION}, which may +be used to conditionally compile application code depending on +the installed Readline version. The value is a hexadecimal +encoding of the major and minor version numbers of the library, +of the form 0x@var{MMmm}. @var{MM} is the two-digit major +version number; @var{mm} is the two-digit minor version number. +For Readline 4.2, for example, the value of +@code{RL_READLINE_VERSION} would be @code{0x0402}. + +@menu +* Readline Typedefs:: C declarations to make code readable. +* Function Writing:: Variables and calling conventions. +@end menu + +@node Readline Typedefs +@subsection Readline Typedefs + +For readabilty, we declare a number of new object types, all pointers +to functions. + +The reason for declaring these new types is to make it easier to write +code describing pointers to C functions with appropriately prototyped +arguments and return values. + +For instance, say we want to declare a variable @var{func} as a pointer +to a function which takes two @code{int} arguments and returns an +@code{int} (this is the type of all of the Readline bindable functions). +Instead of the classic C declaration + +@code{int (*func)();} + +@noindent +or the ANSI-C style declaration + +@code{int (*func)(int, int);} + +@noindent +we may write + +@code{rl_command_func_t *func;} + +The full list of function pointer types available is + +@table @code +@item typedef int rl_command_func_t (int, int); + +@item typedef char *rl_compentry_func_t (const char *, int); + +@item typedef char **rl_completion_func_t (const char *, int, int); + +@item typedef char *rl_quote_func_t (char *, int, char *); + +@item typedef char *rl_dequote_func_t (char *, int); + +@item typedef int rl_compignore_func_t (char **); + +@item typedef void rl_compdisp_func_t (char **, int, int); + +@item typedef int rl_hook_func_t (void); + +@item typedef int rl_getc_func_t (FILE *); + +@item typedef int rl_linebuf_func_t (char *, int); + +@item typedef int rl_intfunc_t (int); +@item #define rl_ivoidfunc_t rl_hook_func_t +@item typedef int rl_icpfunc_t (char *); +@item typedef int rl_icppfunc_t (char **); + +@item typedef void rl_voidfunc_t (void); +@item typedef void rl_vintfunc_t (int); +@item typedef void rl_vcpfunc_t (char *); +@item typedef void rl_vcppfunc_t (char **); + +@end table + +@node Function Writing +@subsection Writing a New Function + +In order to write new functions for Readline, you need to know the +calling conventions for keyboard-invoked functions, and the names of the +variables that describe the current state of the line read so far. + +The calling sequence for a command @code{foo} looks like + +@example +@code{int foo (int count, int key)} +@end example + +@noindent +where @var{count} is the numeric argument (or 1 if defaulted) and +@var{key} is the key that invoked this function. + +It is completely up to the function as to what should be done with the +numeric argument. Some functions use it as a repeat count, some +as a flag, and others to choose alternate behavior (refreshing the current +line as opposed to refreshing the screen, for example). Some choose to +ignore it. In general, if a +function uses the numeric argument as a repeat count, it should be able +to do something useful with both negative and positive arguments. +At the very least, it should be aware that it can be passed a +negative argument. + +A command function should return 0 if its action completes successfully, +and a non-zero value if some error occurs. +This is the convention obeyed by all of the builtin Readline bindable +command functions. + +@node Readline Variables +@section Readline Variables + +These variables are available to function writers. + +@deftypevar {char *} rl_line_buffer +This is the line gathered so far. You are welcome to modify the +contents of the line, but see @ref{Allowing Undoing}. The +function @code{rl_extend_line_buffer} is available to increase +the memory allocated to @code{rl_line_buffer}. +@end deftypevar + +@deftypevar int rl_point +The offset of the current cursor position in @code{rl_line_buffer} +(the @emph{point}). +@end deftypevar + +@deftypevar int rl_end +The number of characters present in @code{rl_line_buffer}. When +@code{rl_point} is at the end of the line, @code{rl_point} and +@code{rl_end} are equal. +@end deftypevar + +@deftypevar int rl_mark +The @var{mark} (saved position) in the current line. If set, the mark +and point define a @emph{region}. +@end deftypevar + +@deftypevar int rl_done +Setting this to a non-zero value causes Readline to return the current +line immediately. +@end deftypevar + +@deftypevar int rl_num_chars_to_read +Setting this to a positive value before calling @code{readline()} causes +Readline to return after accepting that many characters, rather +than reading up to a character bound to @code{accept-line}. +@end deftypevar + +@deftypevar int rl_pending_input +Setting this to a value makes it the next keystroke read. This is a +way to stuff a single character into the input stream. +@end deftypevar + +@deftypevar int rl_dispatching +Set to a non-zero value if a function is being called from a key binding; +zero otherwise. Application functions can test this to discover whether +they were called directly or by Readline's dispatching mechanism. +@end deftypevar + +@deftypevar int rl_erase_empty_line +Setting this to a non-zero value causes Readline to completely erase +the current line, including any prompt, any time a newline is typed as +the only character on an otherwise-empty line. The cursor is moved to +the beginning of the newly-blank line. +@end deftypevar + +@deftypevar {char *} rl_prompt +The prompt Readline uses. This is set from the argument to +@code{readline()}, and should not be assigned to directly. +The @code{rl_set_prompt()} function (@pxref{Redisplay}) may +be used to modify the prompt string after calling @code{readline()}. +@end deftypevar + +@deftypevar int rl_already_prompted +If an application wishes to display the prompt itself, rather than have +Readline do it the first time @code{readline()} is called, it should set +this variable to a non-zero value after displaying the prompt. +The prompt must also be passed as the argument to @code{readline()} so +the redisplay functions can update the display properly. +The calling application is responsible for managing the value; Readline +never sets it. +@end deftypevar + +@deftypevar {const char *} rl_library_version +The version number of this revision of the library. +@end deftypevar + +@deftypevar int rl_readline_version +An integer encoding the current version of the library. The encoding is +of the form 0x@var{MMmm}, where @var{MM} is the two-digit major version +number, and @var{mm} is the two-digit minor version number. +For example, for Readline-4.2, @code{rl_readline_version} would have the +value 0x0402. +@end deftypevar + +@deftypevar {int} rl_gnu_readline_p +Always set to 1, denoting that this is @sc{gnu} readline rather than some +emulation. +@end deftypevar + +@deftypevar {const char *} rl_terminal_name +The terminal type, used for initialization. If not set by the application, +Readline sets this to the value of the @env{TERM} environment variable +the first time it is called. +@end deftypevar + +@deftypevar {const char *} rl_readline_name +This variable is set to a unique name by each application using Readline. +The value allows conditional parsing of the inputrc file +(@pxref{Conditional Init Constructs}). +@end deftypevar + +@deftypevar {FILE *} rl_instream +The stdio stream from which Readline reads input. +If @code{NULL}, Readline defaults to @var{stdin}. +@end deftypevar + +@deftypevar {FILE *} rl_outstream +The stdio stream to which Readline performs output. +If @code{NULL}, Readline defaults to @var{stdout}. +@end deftypevar + +@deftypevar int rl_prefer_env_winsize +If non-zero, Readline gives values found in the @env{LINES} and +@env{COLUMNS} environment variables greater precedence than values fetched +from the kernel when computing the screen dimensions. +@end deftypevar + +@deftypevar {rl_command_func_t *} rl_last_func +The address of the last command function Readline executed. May be used to +test whether or not a function is being executed twice in succession, for +example. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_startup_hook +If non-zero, this is the address of a function to call just +before @code{readline} prints the first prompt. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_pre_input_hook +If non-zero, this is the address of a function to call after +the first prompt has been printed and just before @code{readline} +starts reading input characters. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_event_hook +If non-zero, this is the address of a function to call periodically +when Readline is waiting for terminal input. +By default, this will be called at most ten times a second if there +is no keyboard input. +@end deftypevar + +@deftypevar {rl_getc_func_t *} rl_getc_function +If non-zero, Readline will call indirectly through this pointer +to get a character from the input stream. By default, it is set to +@code{rl_getc}, the default Readline character input function +(@pxref{Character Input}). +@end deftypevar + +@deftypevar {rl_voidfunc_t *} rl_redisplay_function +If non-zero, Readline will call indirectly through this pointer +to update the display with the current contents of the editing buffer. +By default, it is set to @code{rl_redisplay}, the default Readline +redisplay function (@pxref{Redisplay}). +@end deftypevar + +@deftypevar {rl_vintfunc_t *} rl_prep_term_function +If non-zero, Readline will call indirectly through this pointer +to initialize the terminal. The function takes a single argument, an +@code{int} flag that says whether or not to use eight-bit characters. +By default, this is set to @code{rl_prep_terminal} +(@pxref{Terminal Management}). +@end deftypevar + +@deftypevar {rl_voidfunc_t *} rl_deprep_term_function +If non-zero, Readline will call indirectly through this pointer +to reset the terminal. This function should undo the effects of +@code{rl_prep_term_function}. +By default, this is set to @code{rl_deprep_terminal} +(@pxref{Terminal Management}). +@end deftypevar + +@deftypevar {Keymap} rl_executing_keymap +This variable is set to the keymap (@pxref{Keymaps}) in which the +currently executing readline function was found. +@end deftypevar + +@deftypevar {Keymap} rl_binding_keymap +This variable is set to the keymap (@pxref{Keymaps}) in which the +last key binding occurred. +@end deftypevar + +@deftypevar {char *} rl_executing_macro +This variable is set to the text of any currently-executing macro. +@end deftypevar + +@deftypevar {int} rl_readline_state +A variable with bit values that encapsulate the current Readline state. +A bit is set with the @code{RL_SETSTATE} macro, and unset with the +@code{RL_UNSETSTATE} macro. Use the @code{RL_ISSTATE} macro to test +whether a particular state bit is set. Current state bits include: + +@table @code +@item RL_STATE_NONE +Readline has not yet been called, nor has it begun to intialize. +@item RL_STATE_INITIALIZING +Readline is initializing its internal data structures. +@item RL_STATE_INITIALIZED +Readline has completed its initialization. +@item RL_STATE_TERMPREPPED +Readline has modified the terminal modes to do its own input and redisplay. +@item RL_STATE_READCMD +Readline is reading a command from the keyboard. +@item RL_STATE_METANEXT +Readline is reading more input after reading the meta-prefix character. +@item RL_STATE_DISPATCHING +Readline is dispatching to a command. +@item RL_STATE_MOREINPUT +Readline is reading more input while executing an editing command. +@item RL_STATE_ISEARCH +Readline is performing an incremental history search. +@item RL_STATE_NSEARCH +Readline is performing a non-incremental history search. +@item RL_STATE_SEARCH +Readline is searching backward or forward through the history for a string. +@item RL_STATE_NUMERICARG +Readline is reading a numeric argument. +@item RL_STATE_MACROINPUT +Readline is currently getting its input from a previously-defined keyboard +macro. +@item RL_STATE_MACRODEF +Readline is currently reading characters defining a keyboard macro. +@item RL_STATE_OVERWRITE +Readline is in overwrite mode. +@item RL_STATE_COMPLETING +Readline is performing word completion. +@item RL_STATE_SIGHANDLER +Readline is currently executing the readline signal handler. +@item RL_STATE_UNDOING +Readline is performing an undo. +@item RL_STATE_DONE +Readline has read a key sequence bound to @code{accept-line} +and is about to return the line to the caller. +@end table + +@end deftypevar + +@deftypevar {int} rl_explicit_arg +Set to a non-zero value if an explicit numeric argument was specified by +the user. Only valid in a bindable command function. +@end deftypevar + +@deftypevar {int} rl_numeric_arg +Set to the value of any numeric argument explicitly specified by the user +before executing the current Readline function. Only valid in a bindable +command function. +@end deftypevar + +@deftypevar {int} rl_editing_mode +Set to a value denoting Readline's current editing mode. A value of +@var{1} means Readline is currently in emacs mode; @var{0} +means that vi mode is active. +@end deftypevar + + +@node Readline Convenience Functions +@section Readline Convenience Functions + +@menu +* Function Naming:: How to give a function you write a name. +* Keymaps:: Making keymaps. +* Binding Keys:: Changing Keymaps. +* Associating Function Names and Bindings:: Translate function names to + key sequences. +* Allowing Undoing:: How to make your functions undoable. +* Redisplay:: Functions to control line display. +* Modifying Text:: Functions to modify @code{rl_line_buffer}. +* Character Input:: Functions to read keyboard input. +* Terminal Management:: Functions to manage terminal settings. +* Utility Functions:: Generally useful functions and hooks. +* Miscellaneous Functions:: Functions that don't fall into any category. +* Alternate Interface:: Using Readline in a `callback' fashion. +* A Readline Example:: An example Readline function. +@end menu + +@node Function Naming +@subsection Naming a Function + +The user can dynamically change the bindings of keys while using +Readline. This is done by representing the function with a descriptive +name. The user is able to type the descriptive name when referring to +the function. Thus, in an init file, one might find + +@example +Meta-Rubout: backward-kill-word +@end example + +This binds the keystroke @key{Meta-Rubout} to the function +@emph{descriptively} named @code{backward-kill-word}. You, as the +programmer, should bind the functions you write to descriptive names as +well. Readline provides a function for doing that: + +@deftypefun int rl_add_defun (const char *name, rl_command_func_t *function, int key) +Add @var{name} to the list of named functions. Make @var{function} be +the function that gets called. If @var{key} is not -1, then bind it to +@var{function} using @code{rl_bind_key()}. +@end deftypefun + +Using this function alone is sufficient for most applications. +It is the recommended way to add a few functions to the default +functions that Readline has built in. +If you need to do something other than adding a function to Readline, +you may need to use the underlying functions described below. + +@node Keymaps +@subsection Selecting a Keymap + +Key bindings take place on a @dfn{keymap}. The keymap is the +association between the keys that the user types and the functions that +get run. You can make your own keymaps, copy existing keymaps, and tell +Readline which keymap to use. + +@deftypefun Keymap rl_make_bare_keymap (void) +Returns a new, empty keymap. The space for the keymap is allocated with +@code{malloc()}; the caller should free it by calling +@code{rl_discard_keymap()} when done. +@end deftypefun + +@deftypefun Keymap rl_copy_keymap (Keymap map) +Return a new keymap which is a copy of @var{map}. +@end deftypefun + +@deftypefun Keymap rl_make_keymap (void) +Return a new keymap with the printing characters bound to rl_insert, +the lowercase Meta characters bound to run their equivalents, and +the Meta digits bound to produce numeric arguments. +@end deftypefun + +@deftypefun void rl_discard_keymap (Keymap keymap) +Free the storage associated with @var{keymap}. +@end deftypefun + +Readline has several internal keymaps. These functions allow you to +change which keymap is active. + +@deftypefun Keymap rl_get_keymap (void) +Returns the currently active keymap. +@end deftypefun + +@deftypefun void rl_set_keymap (Keymap keymap) +Makes @var{keymap} the currently active keymap. +@end deftypefun + +@deftypefun Keymap rl_get_keymap_by_name (const char *name) +Return the keymap matching @var{name}. @var{name} is one which would +be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}). +@end deftypefun + +@deftypefun {char *} rl_get_keymap_name (Keymap keymap) +Return the name matching @var{keymap}. @var{name} is one which would +be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}). +@end deftypefun + +@node Binding Keys +@subsection Binding Keys + +Key sequences are associate with functions through the keymap. +Readline has several internal keymaps: @code{emacs_standard_keymap}, +@code{emacs_meta_keymap}, @code{emacs_ctlx_keymap}, +@code{vi_movement_keymap}, and @code{vi_insertion_keymap}. +@code{emacs_standard_keymap} is the default, and the examples in +this manual assume that. + +Since @code{readline()} installs a set of default key bindings the first +time it is called, there is always the danger that a custom binding +installed before the first call to @code{readline()} will be overridden. +An alternate mechanism is to install custom key bindings in an +initialization function assigned to the @code{rl_startup_hook} variable +(@pxref{Readline Variables}). + +These functions manage key bindings. + +@deftypefun int rl_bind_key (int key, rl_command_func_t *function) +Binds @var{key} to @var{function} in the currently active keymap. +Returns non-zero in the case of an invalid @var{key}. +@end deftypefun + +@deftypefun int rl_bind_key_in_map (int key, rl_command_func_t *function, Keymap map) +Bind @var{key} to @var{function} in @var{map}. +Returns non-zero in the case of an invalid @var{key}. +@end deftypefun + +@deftypefun int rl_bind_key_if_unbound (int key, rl_command_func_t *function) +Binds @var{key} to @var{function} if it is not already bound in the +currently active keymap. +Returns non-zero in the case of an invalid @var{key} or if @var{key} is +already bound. +@end deftypefun + +@deftypefun int rl_bind_key_if_unbound_in_map (int key, rl_command_func_t *function, Keymap map) +Binds @var{key} to @var{function} if it is not already bound in @var{map}. +Returns non-zero in the case of an invalid @var{key} or if @var{key} is +already bound. +@end deftypefun + +@deftypefun int rl_unbind_key (int key) +Bind @var{key} to the null function in the currently active keymap. +Returns non-zero in case of error. +@end deftypefun + +@deftypefun int rl_unbind_key_in_map (int key, Keymap map) +Bind @var{key} to the null function in @var{map}. +Returns non-zero in case of error. +@end deftypefun + +@deftypefun int rl_unbind_function_in_map (rl_command_func_t *function, Keymap map) +Unbind all keys that execute @var{function} in @var{map}. +@end deftypefun + +@deftypefun int rl_unbind_command_in_map (const char *command, Keymap map) +Unbind all keys that are bound to @var{command} in @var{map}. +@end deftypefun + +@deftypefun int rl_bind_keyseq (const char *keyseq, rl_command_func_t *function) +Bind the key sequence represented by the string @var{keyseq} to the function +@var{function}, beginning in the current keymap. +This makes new keymaps as necessary. +The return value is non-zero if @var{keyseq} is invalid. +@end deftypefun + +@deftypefun int rl_bind_keyseq_in_map (const char *keyseq, rl_command_func_t *function, Keymap map) +Bind the key sequence represented by the string @var{keyseq} to the function +@var{function}. This makes new keymaps as necessary. +Initial bindings are performed in @var{map}. +The return value is non-zero if @var{keyseq} is invalid. +@end deftypefun + +@deftypefun int rl_set_key (const char *keyseq, rl_command_func_t *function, Keymap map) +Equivalent to @code{rl_bind_keyseq_in_map}. +@end deftypefun + +@deftypefun int rl_bind_keyseq_if_unbound (const char *keyseq, rl_command_func_t *function) +Binds @var{keyseq} to @var{function} if it is not already bound in the +currently active keymap. +Returns non-zero in the case of an invalid @var{keyseq} or if @var{keyseq} is +already bound. +@end deftypefun + +@deftypefun int rl_bind_keyseq_if_unbound_in_map (const char *keyseq, rl_command_func_t *function, Keymap map) +Binds @var{keyseq} to @var{function} if it is not already bound in @var{map}. +Returns non-zero in the case of an invalid @var{keyseq} or if @var{keyseq} is +already bound. +@end deftypefun + +@deftypefun int rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) +Bind the key sequence represented by the string @var{keyseq} to the arbitrary +pointer @var{data}. @var{type} says what kind of data is pointed to by +@var{data}; this can be a function (@code{ISFUNC}), a macro +(@code{ISMACR}), or a keymap (@code{ISKMAP}). This makes new keymaps as +necessary. The initial keymap in which to do bindings is @var{map}. +@end deftypefun + +@deftypefun int rl_parse_and_bind (char *line) +Parse @var{line} as if it had been read from the @code{inputrc} file and +perform any key bindings and variable assignments found +(@pxref{Readline Init File}). +@end deftypefun + +@deftypefun int rl_read_init_file (const char *filename) +Read keybindings and variable assignments from @var{filename} +(@pxref{Readline Init File}). +@end deftypefun + +@node Associating Function Names and Bindings +@subsection Associating Function Names and Bindings + +These functions allow you to find out what keys invoke named functions +and the functions invoked by a particular key sequence. You may also +associate a new function name with an arbitrary function. + +@deftypefun {rl_command_func_t *} rl_named_function (const char *name) +Return the function with name @var{name}. +@end deftypefun + +@deftypefun {rl_command_func_t *} rl_function_of_keyseq (const char *keyseq, Keymap map, int *type) +Return the function invoked by @var{keyseq} in keymap @var{map}. +If @var{map} is @code{NULL}, the current keymap is used. If @var{type} is +not @code{NULL}, the type of the object is returned in the @code{int} variable +it points to (one of @code{ISFUNC}, @code{ISKMAP}, or @code{ISMACR}). +@end deftypefun + +@deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function) +Return an array of strings representing the key sequences used to +invoke @var{function} in the current keymap. +@end deftypefun + +@deftypefun {char **} rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) +Return an array of strings representing the key sequences used to +invoke @var{function} in the keymap @var{map}. +@end deftypefun + +@deftypefun void rl_function_dumper (int readable) +Print the readline function names and the key sequences currently +bound to them to @code{rl_outstream}. If @var{readable} is non-zero, +the list is formatted in such a way that it can be made part of an +@code{inputrc} file and re-read. +@end deftypefun + +@deftypefun void rl_list_funmap_names (void) +Print the names of all bindable Readline functions to @code{rl_outstream}. +@end deftypefun + +@deftypefun {const char **} rl_funmap_names (void) +Return a NULL terminated array of known function names. The array is +sorted. The array itself is allocated, but not the strings inside. You +should @code{free()} the array when you are done, but not the pointers. +@end deftypefun + +@deftypefun int rl_add_funmap_entry (const char *name, rl_command_func_t *function) +Add @var{name} to the list of bindable Readline command names, and make +@var{function} the function to be called when @var{name} is invoked. +@end deftypefun + +@node Allowing Undoing +@subsection Allowing Undoing + +Supporting the undo command is a painless thing, and makes your +functions much more useful. It is certainly easy to try +something if you know you can undo it. + +If your function simply inserts text once, or deletes text once, and +uses @code{rl_insert_text()} or @code{rl_delete_text()} to do it, then +undoing is already done for you automatically. + +If you do multiple insertions or multiple deletions, or any combination +of these operations, you should group them together into one operation. +This is done with @code{rl_begin_undo_group()} and +@code{rl_end_undo_group()}. + +The types of events that can be undone are: + +@smallexample +enum undo_code @{ UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END @}; +@end smallexample + +Notice that @code{UNDO_DELETE} means to insert some text, and +@code{UNDO_INSERT} means to delete some text. That is, the undo code +tells what to undo, not how to undo it. @code{UNDO_BEGIN} and +@code{UNDO_END} are tags added by @code{rl_begin_undo_group()} and +@code{rl_end_undo_group()}. + +@deftypefun int rl_begin_undo_group (void) +Begins saving undo information in a group construct. The undo +information usually comes from calls to @code{rl_insert_text()} and +@code{rl_delete_text()}, but could be the result of calls to +@code{rl_add_undo()}. +@end deftypefun + +@deftypefun int rl_end_undo_group (void) +Closes the current undo group started with @code{rl_begin_undo_group +()}. There should be one call to @code{rl_end_undo_group()} +for each call to @code{rl_begin_undo_group()}. +@end deftypefun + +@deftypefun void rl_add_undo (enum undo_code what, int start, int end, char *text) +Remember how to undo an event (according to @var{what}). The affected +text runs from @var{start} to @var{end}, and encompasses @var{text}. +@end deftypefun + +@deftypefun void rl_free_undo_list (void) +Free the existing undo list. +@end deftypefun + +@deftypefun int rl_do_undo (void) +Undo the first thing on the undo list. Returns @code{0} if there was +nothing to undo, non-zero if something was undone. +@end deftypefun + +Finally, if you neither insert nor delete text, but directly modify the +existing text (e.g., change its case), call @code{rl_modifying()} +once, just before you modify the text. You must supply the indices of +the text range that you are going to modify. + +@deftypefun int rl_modifying (int start, int end) +Tell Readline to save the text between @var{start} and @var{end} as a +single undo unit. It is assumed that you will subsequently modify +that text. +@end deftypefun + +@node Redisplay +@subsection Redisplay + +@deftypefun void rl_redisplay (void) +Change what's displayed on the screen to reflect the current contents +of @code{rl_line_buffer}. +@end deftypefun + +@deftypefun int rl_forced_update_display (void) +Force the line to be updated and redisplayed, whether or not +Readline thinks the screen display is correct. +@end deftypefun + +@deftypefun int rl_on_new_line (void) +Tell the update functions that we have moved onto a new (empty) line, +usually after ouputting a newline. +@end deftypefun + +@deftypefun int rl_on_new_line_with_prompt (void) +Tell the update functions that we have moved onto a new line, with +@var{rl_prompt} already displayed. +This could be used by applications that want to output the prompt string +themselves, but still need Readline to know the prompt string length for +redisplay. +It should be used after setting @var{rl_already_prompted}. +@end deftypefun + +@deftypefun int rl_reset_line_state (void) +Reset the display state to a clean state and redisplay the current line +starting on a new line. +@end deftypefun + +@deftypefun int rl_crlf (void) +Move the cursor to the start of the next screen line. +@end deftypefun + +@deftypefun int rl_show_char (int c) +Display character @var{c} on @code{rl_outstream}. +If Readline has not been set to display meta characters directly, this +will convert meta characters to a meta-prefixed key sequence. +This is intended for use by applications which wish to do their own +redisplay. +@end deftypefun + +@deftypefun int rl_message (const char *, @dots{}) +The arguments are a format string as would be supplied to @code{printf}, +possibly containing conversion specifications such as @samp{%d}, and +any additional arguments necessary to satisfy the conversion specifications. +The resulting string is displayed in the @dfn{echo area}. The echo area +is also used to display numeric arguments and search strings. +You should call @code{rl_save_prompt} to save the prompt information +before calling this function. +@end deftypefun + +@deftypefun int rl_clear_message (void) +Clear the message in the echo area. If the prompt was saved with a call to +@code{rl_save_prompt} before the last call to @code{rl_message}, +call @code{rl_restore_prompt} before calling this function. +@end deftypefun + +@deftypefun void rl_save_prompt (void) +Save the local Readline prompt display state in preparation for +displaying a new message in the message area with @code{rl_message()}. +@end deftypefun + +@deftypefun void rl_restore_prompt (void) +Restore the local Readline prompt display state saved by the most +recent call to @code{rl_save_prompt}. +if @code{rl_save_prompt} was called to save the prompt before a call +to @code{rl_message}, this function should be called before the +corresponding call to @code{rl_clear_message}. +@end deftypefun + +@deftypefun int rl_expand_prompt (char *prompt) +Expand any special character sequences in @var{prompt} and set up the +local Readline prompt redisplay variables. +This function is called by @code{readline()}. It may also be called to +expand the primary prompt if the @code{rl_on_new_line_with_prompt()} +function or @code{rl_already_prompted} variable is used. +It returns the number of visible characters on the last line of the +(possibly multi-line) prompt. +Applications may indicate that the prompt contains characters that take +up no physical screen space when displayed by bracketing a sequence of +such characters with the special markers @code{RL_PROMPT_START_IGNORE} +and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}. This may +be used to embed terminal-specific escape sequences in prompts. +@end deftypefun + +@deftypefun int rl_set_prompt (const char *prompt) +Make Readline use @var{prompt} for subsequent redisplay. This calls +@code{rl_expand_prompt()} to expand the prompt and sets @code{rl_prompt} +to the result. +@end deftypefun + +@node Modifying Text +@subsection Modifying Text + +@deftypefun int rl_insert_text (const char *text) +Insert @var{text} into the line at the current cursor position. +Returns the number of characters inserted. +@end deftypefun + +@deftypefun int rl_delete_text (int start, int end) +Delete the text between @var{start} and @var{end} in the current line. +Returns the number of characters deleted. +@end deftypefun + +@deftypefun {char *} rl_copy_text (int start, int end) +Return a copy of the text between @var{start} and @var{end} in +the current line. +@end deftypefun + +@deftypefun int rl_kill_text (int start, int end) +Copy the text between @var{start} and @var{end} in the current line +to the kill ring, appending or prepending to the last kill if the +last command was a kill command. The text is deleted. +If @var{start} is less than @var{end}, +the text is appended, otherwise prepended. If the last command was +not a kill, a new kill ring slot is used. +@end deftypefun + +@deftypefun int rl_push_macro_input (char *macro) +Cause @var{macro} to be inserted into the line, as if it had been invoked +by a key bound to a macro. Not especially useful; use +@code{rl_insert_text()} instead. +@end deftypefun + +@node Character Input +@subsection Character Input + +@deftypefun int rl_read_key (void) +Return the next character available from Readline's current input stream. +This handles input inserted into +the input stream via @var{rl_pending_input} (@pxref{Readline Variables}) +and @code{rl_stuff_char()}, macros, and characters read from the keyboard. +While waiting for input, this function will call any function assigned to +the @code{rl_event_hook} variable. +@end deftypefun + +@deftypefun int rl_getc (FILE *stream) +Return the next character available from @var{stream}, which is assumed to +be the keyboard. +@end deftypefun + +@deftypefun int rl_stuff_char (int c) +Insert @var{c} into the Readline input stream. It will be "read" +before Readline attempts to read characters from the terminal with +@code{rl_read_key()}. Up to 512 characters may be pushed back. +@code{rl_stuff_char} returns 1 if the character was successfully inserted; +0 otherwise. +@end deftypefun + +@deftypefun int rl_execute_next (int c) +Make @var{c} be the next command to be executed when @code{rl_read_key()} +is called. This sets @var{rl_pending_input}. +@end deftypefun + +@deftypefun int rl_clear_pending_input (void) +Unset @var{rl_pending_input}, effectively negating the effect of any +previous call to @code{rl_execute_next()}. This works only if the +pending input has not already been read with @code{rl_read_key()}. +@end deftypefun + +@deftypefun int rl_set_keyboard_input_timeout (int u) +While waiting for keyboard input in @code{rl_read_key()}, Readline will +wait for @var{u} microseconds for input before calling any function +assigned to @code{rl_event_hook}. The default waiting period is +one-tenth of a second. Returns the old timeout value. +@end deftypefun + +@node Terminal Management +@subsection Terminal Management + +@deftypefun void rl_prep_terminal (int meta_flag) +Modify the terminal settings for Readline's use, so @code{readline()} +can read a single character at a time from the keyboard. +The @var{meta_flag} argument should be non-zero if Readline should +read eight-bit input. +@end deftypefun + +@deftypefun void rl_deprep_terminal (void) +Undo the effects of @code{rl_prep_terminal()}, leaving the terminal in +the state in which it was before the most recent call to +@code{rl_prep_terminal()}. +@end deftypefun + +@deftypefun void rl_tty_set_default_bindings (Keymap kmap) +Read the operating system's terminal editing characters (as would be +displayed by @code{stty}) to their Readline equivalents. +The bindings are performed in @var{kmap}. +@end deftypefun + +@deftypefun void rl_tty_unset_default_bindings (Keymap kmap) +Reset the bindings manipulated by @code{rl_tty_set_default_bindings} so +that the terminal editing characters are bound to @code{rl_insert}. +The bindings are performed in @var{kmap}. +@end deftypefun + +@deftypefun int rl_reset_terminal (const char *terminal_name) +Reinitialize Readline's idea of the terminal settings using +@var{terminal_name} as the terminal type (e.g., @code{vt100}). +If @var{terminal_name} is @code{NULL}, the value of the @code{TERM} +environment variable is used. +@end deftypefun + +@node Utility Functions +@subsection Utility Functions + +@deftypefun void rl_replace_line (const char *text, int clear_undo) +Replace the contents of @code{rl_line_buffer} with @var{text}. +The point and mark are preserved, if possible. +If @var{clear_undo} is non-zero, the undo list associated with the +current line is cleared. +@end deftypefun + +@deftypefun int rl_extend_line_buffer (int len) +Ensure that @code{rl_line_buffer} has enough space to hold @var{len} +characters, possibly reallocating it if necessary. +@end deftypefun + +@deftypefun int rl_initialize (void) +Initialize or re-initialize Readline's internal state. +It's not strictly necessary to call this; @code{readline()} calls it before +reading any input. +@end deftypefun + +@deftypefun int rl_ding (void) +Ring the terminal bell, obeying the setting of @code{bell-style}. +@end deftypefun + +@deftypefun int rl_alphabetic (int c) +Return 1 if @var{c} is an alphabetic character. +@end deftypefun + +@deftypefun void rl_display_match_list (char **matches, int len, int max) +A convenience function for displaying a list of strings in +columnar format on Readline's output stream. @code{matches} is the list +of strings, in argv format, such as a list of completion matches. +@code{len} is the number of strings in @code{matches}, and @code{max} +is the length of the longest string in @code{matches}. This function uses +the setting of @code{print-completions-horizontally} to select how the +matches are displayed (@pxref{Readline Init File Syntax}). +@end deftypefun + +The following are implemented as macros, defined in @code{chardefs.h}. +Applications should refrain from using them. + +@deftypefun int _rl_uppercase_p (int c) +Return 1 if @var{c} is an uppercase alphabetic character. +@end deftypefun + +@deftypefun int _rl_lowercase_p (int c) +Return 1 if @var{c} is a lowercase alphabetic character. +@end deftypefun + +@deftypefun int _rl_digit_p (int c) +Return 1 if @var{c} is a numeric character. +@end deftypefun + +@deftypefun int _rl_to_upper (int c) +If @var{c} is a lowercase alphabetic character, return the corresponding +uppercase character. +@end deftypefun + +@deftypefun int _rl_to_lower (int c) +If @var{c} is an uppercase alphabetic character, return the corresponding +lowercase character. +@end deftypefun + +@deftypefun int _rl_digit_value (int c) +If @var{c} is a number, return the value it represents. +@end deftypefun + +@node Miscellaneous Functions +@subsection Miscellaneous Functions + +@deftypefun int rl_macro_bind (const char *keyseq, const char *macro, Keymap map) +Bind the key sequence @var{keyseq} to invoke the macro @var{macro}. +The binding is performed in @var{map}. When @var{keyseq} is invoked, the +@var{macro} will be inserted into the line. This function is deprecated; +use @code{rl_generic_bind()} instead. +@end deftypefun + +@deftypefun void rl_macro_dumper (int readable) +Print the key sequences bound to macros and their values, using +the current keymap, to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_variable_bind (const char *variable, const char *value) +Make the Readline variable @var{variable} have @var{value}. +This behaves as if the readline command +@samp{set @var{variable} @var{value}} had been executed in an @code{inputrc} +file (@pxref{Readline Init File Syntax}). +@end deftypefun + +@deftypefun {char *} rl_variable_value (const char *variable) +Return a string representing the value of the Readline variable @var{variable}. +For boolean variables, this string is either @samp{on} or @samp{off}. +@end deftypefun + +@deftypefun void rl_variable_dumper (int readable) +Print the readline variable names and their current values +to @code{rl_outstream}. +If @var{readable} is non-zero, the list is formatted in such a way +that it can be made part of an @code{inputrc} file and re-read. +@end deftypefun + +@deftypefun int rl_set_paren_blink_timeout (int u) +Set the time interval (in microseconds) that Readline waits when showing +a balancing character when @code{blink-matching-paren} has been enabled. +@end deftypefun + +@deftypefun {char *} rl_get_termcap (const char *cap) +Retrieve the string value of the termcap capability @var{cap}. +Readline fetches the termcap entry for the current terminal name and +uses those capabilities to move around the screen line and perform other +terminal-specific operations, like erasing a line. Readline does not +use all of a terminal's capabilities, and this function will return +values for only those capabilities Readline uses. +@end deftypefun + +@node Alternate Interface +@subsection Alternate Interface + +An alternate interface is available to plain @code{readline()}. Some +applications need to interleave keyboard I/O with file, device, or +window system I/O, typically by using a main loop to @code{select()} +on various file descriptors. To accomodate this need, readline can +also be invoked as a `callback' function from an event loop. There +are functions available to make this easy. + +@deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler) +Set up the terminal for readline I/O and display the initial +expanded value of @var{prompt}. Save the value of @var{lhandler} to +use as a function to call when a complete line of input has been entered. +The function takes the text of the line as an argument. +@end deftypefun + +@deftypefun void rl_callback_read_char (void) +Whenever an application determines that keyboard input is available, it +should call @code{rl_callback_read_char()}, which will read the next +character from the current input source. +If that character completes the line, @code{rl_callback_read_char} will +invoke the @var{lhandler} function saved by @code{rl_callback_handler_install} +to process the line. +Before calling the @var{lhandler} function, the terminal settings are +reset to the values they had before calling +@code{rl_callback_handler_install}. +If the @var{lhandler} function returns, +the terminal settings are modified for Readline's use again. +@code{EOF} is indicated by calling @var{lhandler} with a +@code{NULL} line. +@end deftypefun + +@deftypefun void rl_callback_handler_remove (void) +Restore the terminal to its initial state and remove the line handler. +This may be called from within a callback as well as independently. +If the @var{lhandler} installed by @code{rl_callback_handler_install} +does not exit the program, either this function or the function referred +to by the value of @code{rl_deprep_term_function} should be called before +the program exits to reset the terminal settings. +@end deftypefun + +@node A Readline Example +@subsection A Readline Example + +Here is a function which changes lowercase characters to their uppercase +equivalents, and uppercase characters to lowercase. If +this function was bound to @samp{M-c}, then typing @samp{M-c} would +change the case of the character under point. Typing @samp{M-1 0 M-c} +would change the case of the following 10 characters, leaving the cursor on +the last character changed. + +@example +/* Invert the case of the COUNT following characters. */ +int +invert_case_line (count, key) + int count, key; +@{ + register int start, end, i; + + start = rl_point; + + if (rl_point >= rl_end) + return (0); + + if (count < 0) + @{ + direction = -1; + count = -count; + @} + else + direction = 1; + + /* Find the end of the range to modify. */ + end = start + (count * direction); + + /* Force it to be within range. */ + if (end > rl_end) + end = rl_end; + else if (end < 0) + end = 0; + + if (start == end) + return (0); + + if (start > end) + @{ + int temp = start; + start = end; + end = temp; + @} + + /* Tell readline that we are modifying the line, + so it will save the undo information. */ + rl_modifying (start, end); + + for (i = start; i != end; i++) + @{ + if (_rl_uppercase_p (rl_line_buffer[i])) + rl_line_buffer[i] = _rl_to_lower (rl_line_buffer[i]); + else if (_rl_lowercase_p (rl_line_buffer[i])) + rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]); + @} + /* Move point to on top of the last character changed. */ + rl_point = (direction == 1) ? end - 1 : start; + return (0); +@} +@end example + +@node Readline Signal Handling +@section Readline Signal Handling + +Signals are asynchronous events sent to a process by the Unix kernel, +sometimes on behalf of another process. They are intended to indicate +exceptional events, like a user pressing the interrupt key on his terminal, +or a network connection being broken. There is a class of signals that can +be sent to the process currently reading input from the keyboard. Since +Readline changes the terminal attributes when it is called, it needs to +perform special processing when such a signal is received in order to +restore the terminal to a sane state, or provide application writers with +functions to do so manually. + +Readline contains an internal signal handler that is installed for a +number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, +@code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}). +When one of these signals is received, the signal handler +will reset the terminal attributes to those that were in effect before +@code{readline()} was called, reset the signal handling to what it was +before @code{readline()} was called, and resend the signal to the calling +application. +If and when the calling application's signal handler returns, Readline +will reinitialize the terminal and continue to accept input. +When a @code{SIGINT} is received, the Readline signal handler performs +some additional work, which will cause any partially-entered line to be +aborted (see the description of @code{rl_free_line_state()} below). + +There is an additional Readline signal handler, for @code{SIGWINCH}, which +the kernel sends to a process whenever the terminal's size changes (for +example, if a user resizes an @code{xterm}). The Readline @code{SIGWINCH} +handler updates Readline's internal screen size information, and then calls +any @code{SIGWINCH} signal handler the calling application has installed. +Readline calls the application's @code{SIGWINCH} signal handler without +resetting the terminal to its original state. If the application's signal +handler does more than update its idea of the terminal size and return (for +example, a @code{longjmp} back to a main processing loop), it @emph{must} +call @code{rl_cleanup_after_signal()} (described below), to restore the +terminal state. + +Readline provides two variables that allow application writers to +control whether or not it will catch certain signals and act on them +when they are received. It is important that applications change the +values of these variables only when calling @code{readline()}, not in +a signal handler, so Readline's internal signal state is not corrupted. + +@deftypevar int rl_catch_signals +If this variable is non-zero, Readline will install signal handlers for +@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGALRM}, +@code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}. + +The default value of @code{rl_catch_signals} is 1. +@end deftypevar + +@deftypevar int rl_catch_sigwinch +If this variable is non-zero, Readline will install a signal handler for +@code{SIGWINCH}. + +The default value of @code{rl_catch_sigwinch} is 1. +@end deftypevar + +If an application does not wish to have Readline catch any signals, or +to handle signals other than those Readline catches (@code{SIGHUP}, +for example), +Readline provides convenience functions to do the necessary terminal +and internal state cleanup upon receipt of a signal. + +@deftypefun void rl_cleanup_after_signal (void) +This function will reset the state of the terminal to what it was before +@code{readline()} was called, and remove the Readline signal handlers for +all signals, depending on the values of @code{rl_catch_signals} and +@code{rl_catch_sigwinch}. +@end deftypefun + +@deftypefun void rl_free_line_state (void) +This will free any partial state associated with the current input line +(undo information, any partial history entry, any partially-entered +keyboard macro, and any partially-entered numeric argument). This +should be called before @code{rl_cleanup_after_signal()}. The +Readline signal handler for @code{SIGINT} calls this to abort the +current input line. +@end deftypefun + +@deftypefun void rl_reset_after_signal (void) +This will reinitialize the terminal and reinstall any Readline signal +handlers, depending on the values of @code{rl_catch_signals} and +@code{rl_catch_sigwinch}. +@end deftypefun + +If an application does not wish Readline to catch @code{SIGWINCH}, it may +call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force +Readline to update its idea of the terminal size when a @code{SIGWINCH} +is received. + +@deftypefun void rl_resize_terminal (void) +Update Readline's internal screen size by reading values from the kernel. +@end deftypefun + +@deftypefun void rl_set_screen_size (int rows, int cols) +Set Readline's idea of the terminal size to @var{rows} rows and +@var{cols} columns. If either @var{rows} or @var{columns} is less than +or equal to 0, Readline's idea of that terminal dimension is unchanged. +@end deftypefun + +If an application does not want to install a @code{SIGWINCH} handler, but +is still interested in the screen dimensions, Readline's idea of the screen +size may be queried. + +@deftypefun void rl_get_screen_size (int *rows, int *cols) +Return Readline's idea of the terminal's size in the +variables pointed to by the arguments. +@end deftypefun + +@deftypefun void rl_reset_screen_size (void) +Cause Readline to reobtain the screen size and recalculate its dimensions. +@end deftypefun + +The following functions install and remove Readline's signal handlers. + +@deftypefun int rl_set_signals (void) +Install Readline's signal handler for @code{SIGINT}, @code{SIGQUIT}, +@code{SIGTERM}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, +@code{SIGTTOU}, and @code{SIGWINCH}, depending on the values of +@code{rl_catch_signals} and @code{rl_catch_sigwinch}. +@end deftypefun + +@deftypefun int rl_clear_signals (void) +Remove all of the Readline signal handlers installed by +@code{rl_set_signals()}. +@end deftypefun + +@node Custom Completers +@section Custom Completers +@cindex application-specific completion functions + +Typically, a program that reads commands from the user has a way of +disambiguating commands and data. If your program is one of these, then +it can provide completion for commands, data, or both. +The following sections describe how your program and Readline +cooperate to provide this service. + +@menu +* How Completing Works:: The logic used to do completion. +* Completion Functions:: Functions provided by Readline. +* Completion Variables:: Variables which control completion. +* A Short Completion Example:: An example of writing completer subroutines. +@end menu + +@node How Completing Works +@subsection How Completing Works + +In order to complete some text, the full list of possible completions +must be available. That is, it is not possible to accurately +expand a partial word without knowing all of the possible words +which make sense in that context. The Readline library provides +the user interface to completion, and two of the most common +completion functions: filename and username. For completing other types +of text, you must write your own completion function. This section +describes exactly what such functions must do, and provides an example. + +There are three major functions used to perform completion: + +@enumerate +@item +The user-interface function @code{rl_complete()}. This function is +called with the same arguments as other bindable Readline functions: +@var{count} and @var{invoking_key}. +It isolates the word to be completed and calls +@code{rl_completion_matches()} to generate a list of possible completions. +It then either lists the possible completions, inserts the possible +completions, or actually performs the +completion, depending on which behavior is desired. + +@item +The internal function @code{rl_completion_matches()} uses an +application-supplied @dfn{generator} function to generate the list of +possible matches, and then returns the array of these matches. +The caller should place the address of its generator function in +@code{rl_completion_entry_function}. + +@item +The generator function is called repeatedly from +@code{rl_completion_matches()}, returning a string each time. The +arguments to the generator function are @var{text} and @var{state}. +@var{text} is the partial word to be completed. @var{state} is zero the +first time the function is called, allowing the generator to perform +any necessary initialization, and a positive non-zero integer for +each subsequent call. The generator function returns +@code{(char *)NULL} to inform @code{rl_completion_matches()} that there are +no more possibilities left. Usually the generator function computes the +list of possible completions when @var{state} is zero, and returns them +one at a time on subsequent calls. Each string the generator function +returns as a match must be allocated with @code{malloc()}; Readline +frees the strings when it has finished with them. +Such a generator function is referred to as an +@dfn{application-specific completion function}. + +@end enumerate + +@deftypefun int rl_complete (int ignore, int invoking_key) +Complete the word at or before point. You have supplied the function +that does the initial simple matching selection algorithm (see +@code{rl_completion_matches()}). The default is to do filename completion. +@end deftypefun + +@deftypevar {rl_compentry_func_t *} rl_completion_entry_function +This is a pointer to the generator function for +@code{rl_completion_matches()}. +If the value of @code{rl_completion_entry_function} is +@code{NULL} then the default filename generator +function, @code{rl_filename_completion_function()}, is used. +An @dfn{application-specific completion function} is a function whose +address is assigned to @code{rl_completion_entry_function} and whose +return values are used to generate possible completions. +@end deftypevar + +@node Completion Functions +@subsection Completion Functions + +Here is the complete list of callable completion functions present in +Readline. + +@deftypefun int rl_complete_internal (int what_to_do) +Complete the word at or before point. @var{what_to_do} says what to do +with the completion. A value of @samp{?} means list the possible +completions. @samp{TAB} means do standard completion. @samp{*} means +insert all of the possible completions. @samp{!} means to display +all of the possible completions, if there is more than one, as well as +performing partial completion. @samp{@@} is similar to @samp{!}, but +possible completions are not listed if the possible completions share +a common prefix. +@end deftypefun + +@deftypefun int rl_complete (int ignore, int invoking_key) +Complete the word at or before point. You have supplied the function +that does the initial simple matching selection algorithm (see +@code{rl_completion_matches()} and @code{rl_completion_entry_function}). +The default is to do filename +completion. This calls @code{rl_complete_internal()} with an +argument depending on @var{invoking_key}. +@end deftypefun + +@deftypefun int rl_possible_completions (int count, int invoking_key) +List the possible completions. See description of @code{rl_complete +()}. This calls @code{rl_complete_internal()} with an argument of +@samp{?}. +@end deftypefun + +@deftypefun int rl_insert_completions (int count, int invoking_key) +Insert the list of possible completions into the line, deleting the +partially-completed word. See description of @code{rl_complete()}. +This calls @code{rl_complete_internal()} with an argument of @samp{*}. +@end deftypefun + +@deftypefun int rl_completion_mode (rl_command_func_t *cfunc) +Returns the apppriate value to pass to @code{rl_complete_internal()} +depending on whether @var{cfunc} was called twice in succession and +the values of the @code{show-all-if-ambiguous} and +@code{show-all-if-unmodified} variables. +Application-specific completion functions may use this function to present +the same interface as @code{rl_complete()}. +@end deftypefun + +@deftypefun {char **} rl_completion_matches (const char *text, rl_compentry_func_t *entry_func) +Returns an array of strings which is a list of completions for +@var{text}. If there are no completions, returns @code{NULL}. +The first entry in the returned array is the substitution for @var{text}. +The remaining entries are the possible completions. The array is +terminated with a @code{NULL} pointer. + +@var{entry_func} is a function of two args, and returns a +@code{char *}. The first argument is @var{text}. The second is a +state argument; it is zero on the first call, and non-zero on subsequent +calls. @var{entry_func} returns a @code{NULL} pointer to the caller +when there are no more matches. +@end deftypefun + +@deftypefun {char *} rl_filename_completion_function (const char *text, int state) +A generator function for filename completion in the general case. +@var{text} is a partial filename. +The Bash source is a useful reference for writing application-specific +completion functions (the Bash completion functions call this and other +Readline functions). +@end deftypefun + +@deftypefun {char *} rl_username_completion_function (const char *text, int state) +A completion generator for usernames. @var{text} contains a partial +username preceded by a random character (usually @samp{~}). As with all +completion generators, @var{state} is zero on the first call and non-zero +for subsequent calls. +@end deftypefun + +@node Completion Variables +@subsection Completion Variables + +@deftypevar {rl_compentry_func_t *} rl_completion_entry_function +A pointer to the generator function for @code{rl_completion_matches()}. +@code{NULL} means to use @code{rl_filename_completion_function()}, +the default filename completer. +@end deftypevar + +@deftypevar {rl_completion_func_t *} rl_attempted_completion_function +A pointer to an alternative function to create matches. +The function is called with @var{text}, @var{start}, and @var{end}. +@var{start} and @var{end} are indices in @code{rl_line_buffer} defining +the boundaries of @var{text}, which is a character string. +If this function exists and returns @code{NULL}, or if this variable is +set to @code{NULL}, then @code{rl_complete()} will call the value of +@code{rl_completion_entry_function} to generate matches, otherwise the +array of strings returned will be used. +If this function sets the @code{rl_attempted_completion_over} +variable to a non-zero value, Readline will not perform its default +completion even if this function returns no matches. +@end deftypevar + +@deftypevar {rl_quote_func_t *} rl_filename_quoting_function +A pointer to a function that will quote a filename in an +application-specific fashion. This is called if filename completion is being +attempted and one of the characters in @code{rl_filename_quote_characters} +appears in a completed filename. The function is called with +@var{text}, @var{match_type}, and @var{quote_pointer}. The @var{text} +is the filename to be quoted. The @var{match_type} is either +@code{SINGLE_MATCH}, if there is only one completion match, or +@code{MULT_MATCH}. Some functions use this to decide whether or not to +insert a closing quote character. The @var{quote_pointer} is a pointer +to any opening quote character the user typed. Some functions choose +to reset this character. +@end deftypevar + +@deftypevar {rl_dequote_func_t *} rl_filename_dequoting_function +A pointer to a function that will remove application-specific quoting +characters from a filename before completion is attempted, so those +characters do not interfere with matching the text against names in +the filesystem. It is called with @var{text}, the text of the word +to be dequoted, and @var{quote_char}, which is the quoting character +that delimits the filename (usually @samp{'} or @samp{"}). If +@var{quote_char} is zero, the filename was not in an embedded string. +@end deftypevar + +@deftypevar {rl_linebuf_func_t *} rl_char_is_quoted_p +A pointer to a function to call that determines whether or not a specific +character in the line buffer is quoted, according to whatever quoting +mechanism the program calling Readline uses. The function is called with +two arguments: @var{text}, the text of the line, and @var{index}, the +index of the character in the line. It is used to decide whether a +character found in @code{rl_completer_word_break_characters} should be +used to break words for the completer. +@end deftypevar + +@deftypevar {rl_compignore_func_t *} rl_ignore_some_completions_function +This function, if defined, is called by the completer when real filename +completion is done, after all the matching names have been generated. +It is passed a @code{NULL} terminated array of matches. +The first element (@code{matches[0]}) is the +maximal substring common to all matches. This function can +re-arrange the list of matches as required, but each element deleted +from the array must be freed. +@end deftypevar + +@deftypevar {rl_icppfunc_t *} rl_directory_completion_hook +This function, if defined, is allowed to modify the directory portion +of filenames Readline completes. It is called with the address of a +string (the current directory name) as an argument, and may modify that string. +If the string is replaced with a new string, the old value should be freed. +Any modified directory name should have a trailing slash. +The modified value will be displayed as part of the completion, replacing +the directory portion of the pathname the user typed. +It returns an integer that should be non-zero if the function modifies +its directory argument. +It could be used to expand symbolic links or shell variables in pathnames. +@end deftypevar + +@deftypevar {rl_compdisp_func_t *} rl_completion_display_matches_hook +If non-zero, then this is the address of a function to call when +completing a word would normally display the list of possible matches. +This function is called in lieu of Readline displaying the list. +It takes three arguments: +(@code{char **}@var{matches}, @code{int} @var{num_matches}, @code{int} @var{max_length}) +where @var{matches} is the array of matching strings, +@var{num_matches} is the number of strings in that array, and +@var{max_length} is the length of the longest string in that array. +Readline provides a convenience function, @code{rl_display_match_list}, +that takes care of doing the display to Readline's output stream. That +function may be called from this hook. +@end deftypevar + +@deftypevar {const char *} rl_basic_word_break_characters +The basic list of characters that signal a break between words for the +completer routine. The default value of this variable is the characters +which break words for completion in Bash: +@code{" \t\n\"\\'`@@$><=;|&@{("}. +@end deftypevar + +@deftypevar {const char *} rl_basic_quote_characters +A list of quote characters which can cause a word break. +@end deftypevar + +@deftypevar {const char *} rl_completer_word_break_characters +The list of characters that signal a break between words for +@code{rl_complete_internal()}. The default list is the value of +@code{rl_basic_word_break_characters}. +@end deftypevar + +@deftypevar {rl_cpvfunc_t *} rl_completion_word_break_hook +If non-zero, this is the address of a function to call when Readline is +deciding where to separate words for word completion. It should return +a character string like @code{rl_completer_word_break_characters} to be +used to perform the current completion. The function may choose to set +@code{rl_completer_word_break_characters} itself. If the function +returns @code{NULL}, @code{rl_completer_word_break_characters} is used. +@end deftypevar + +@deftypevar {const char *} rl_completer_quote_characters +A list of characters which can be used to quote a substring of the line. +Completion occurs on the entire substring, and within the substring +@code{rl_completer_word_break_characters} are treated as any other character, +unless they also appear within this list. +@end deftypevar + +@deftypevar {const char *} rl_filename_quote_characters +A list of characters that cause a filename to be quoted by the completer +when they appear in a completed filename. The default is the null string. +@end deftypevar + +@deftypevar {const char *} rl_special_prefixes +The list of characters that are word break characters, but should be +left in @var{text} when it is passed to the completion function. +Programs can use this to help determine what kind of completing to do. +For instance, Bash sets this variable to "$@@" so that it can complete +shell variables and hostnames. +@end deftypevar + +@deftypevar int rl_completion_query_items +Up to this many items will be displayed in response to a +possible-completions call. After that, readline asks the user if she is sure +she wants to see them all. The default value is 100. A negative value +indicates that Readline should never ask the user. +@end deftypevar + +@deftypevar {int} rl_completion_append_character +When a single completion alternative matches at the end of the command +line, this character is appended to the inserted completion text. The +default is a space character (@samp{ }). Setting this to the null +character (@samp{\0}) prevents anything being appended automatically. +This can be changed in application-specific completion functions to +provide the ``most sensible word separator character'' according to +an application-specific command line syntax specification. +@end deftypevar + +@deftypevar int rl_completion_suppress_append +If non-zero, @var{rl_completion_append_character} is not appended to +matches at the end of the command line, as described above. +It is set to 0 before any application-specific completion function +is called, and may only be changed within such a function. +@end deftypevar + +@deftypevar int rl_completion_quote_character +When Readline is completing quoted text, as delimited by one of the +characters in @var{rl_completer_quote_characters}, it sets this variable +to the quoting character found. +This is set before any application-specific completion function is called. +@end deftypevar + +@deftypevar int rl_completion_suppress_quote +If non-zero, Readline does not append a matching quote character when +performing completion on a quoted string. +It is set to 0 before any application-specific completion function +is called, and may only be changed within such a function. +@end deftypevar + +@deftypevar int rl_completion_found_quote +When Readline is completing quoted text, it sets this variable +to a non-zero value if the word being completed contains or is delimited +by any quoting characters, including backslashes. +This is set before any application-specific completion function is called. +@end deftypevar + +@deftypevar int rl_completion_mark_symlink_dirs +If non-zero, a slash will be appended to completed filenames that are +symbolic links to directory names, subject to the value of the +user-settable @var{mark-directories} variable. +This variable exists so that application-specific completion functions +can override the user's global preference (set via the +@var{mark-symlinked-directories} Readline variable) if appropriate. +This variable is set to the user's preference before any +application-specific completion function is called, so unless that +function modifies the value, the user's preferences are honored. +@end deftypevar + +@deftypevar int rl_ignore_completion_duplicates +If non-zero, then duplicates in the matches are removed. +The default is 1. +@end deftypevar + +@deftypevar int rl_filename_completion_desired +Non-zero means that the results of the matches are to be treated as +filenames. This is @emph{always} zero when completion is attempted, +and can only be changed +within an application-specific completion function. If it is set to a +non-zero value by such a function, directory names have a slash appended +and Readline attempts to quote completed filenames if they contain any +characters in @code{rl_filename_quote_characters} and +@code{rl_filename_quoting_desired} is set to a non-zero value. +@end deftypevar + +@deftypevar int rl_filename_quoting_desired +Non-zero means that the results of the matches are to be quoted using +double quotes (or an application-specific quoting mechanism) if the +completed filename contains any characters in +@code{rl_filename_quote_chars}. This is @emph{always} non-zero +when completion is attempted, and can only be changed within an +application-specific completion function. +The quoting is effected via a call to the function pointed to +by @code{rl_filename_quoting_function}. +@end deftypevar + +@deftypevar int rl_attempted_completion_over +If an application-specific completion function assigned to +@code{rl_attempted_completion_function} sets this variable to a non-zero +value, Readline will not perform its default filename completion even +if the application's completion function returns no matches. +It should be set only by an application's completion function. +@end deftypevar + +@deftypevar int rl_completion_type +Set to a character describing the type of completion Readline is currently +attempting; see the description of @code{rl_complete_internal()} +(@pxref{Completion Functions}) for the list of characters. +This is set to the appropriate value before any application-specific +completion function is called, allowing such functions to present +the same interface as @code{rl_complete()}. +@end deftypevar + +@deftypevar int rl_inhibit_completion +If this variable is non-zero, completion is inhibited. The completion +character will be inserted as any other bound to @code{self-insert}. +@end deftypevar + +@node A Short Completion Example +@subsection A Short Completion Example + +Here is a small application demonstrating the use of the GNU Readline +library. It is called @code{fileman}, and the source code resides in +@file{examples/fileman.c}. This sample application provides +completion of command names, line editing features, and access to the +history list. + +@page +@smallexample +/* fileman.c -- A tiny application which demonstrates how to use the + GNU Readline library. This application interactively allows users + to manipulate files and their modes. */ + +#include +#include +#include +#include +#include + +#include +#include + +extern char *xmalloc (); + +/* The names of functions that actually do the manipulation. */ +int com_list __P((char *)); +int com_view __P((char *)); +int com_rename __P((char *)); +int com_stat __P((char *)); +int com_pwd __P((char *)); +int com_delete __P((char *)); +int com_help __P((char *)); +int com_cd __P((char *)); +int com_quit __P((char *)); + +/* A structure which contains information on the commands this program + can understand. */ + +typedef struct @{ + char *name; /* User printable name of the function. */ + rl_icpfunc_t *func; /* Function to call to do the job. */ + char *doc; /* Documentation for this function. */ +@} COMMAND; + +COMMAND commands[] = @{ + @{ "cd", com_cd, "Change to directory DIR" @}, + @{ "delete", com_delete, "Delete FILE" @}, + @{ "help", com_help, "Display this text" @}, + @{ "?", com_help, "Synonym for `help'" @}, + @{ "list", com_list, "List files in DIR" @}, + @{ "ls", com_list, "Synonym for `list'" @}, + @{ "pwd", com_pwd, "Print the current working directory" @}, + @{ "quit", com_quit, "Quit using Fileman" @}, + @{ "rename", com_rename, "Rename FILE to NEWNAME" @}, + @{ "stat", com_stat, "Print out statistics on FILE" @}, + @{ "view", com_view, "View the contents of FILE" @}, + @{ (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL @} +@}; + +/* Forward declarations. */ +char *stripwhite (); +COMMAND *find_command (); + +/* The name of this program, as taken from argv[0]. */ +char *progname; + +/* When non-zero, this means the user is done using this program. */ +int done; + +char * +dupstr (s) + int s; +@{ + char *r; + + r = xmalloc (strlen (s) + 1); + strcpy (r, s); + return (r); +@} + +main (argc, argv) + int argc; + char **argv; +@{ + char *line, *s; + + progname = argv[0]; + + initialize_readline (); /* Bind our completer. */ + + /* Loop reading and executing lines until the user quits. */ + for ( ; done == 0; ) + @{ + line = readline ("FileMan: "); + + if (!line) + break; + + /* Remove leading and trailing whitespace from the line. + Then, if there is anything left, add it to the history list + and execute it. */ + s = stripwhite (line); + + if (*s) + @{ + add_history (s); + execute_line (s); + @} + + free (line); + @} + exit (0); +@} + +/* Execute a command line. */ +int +execute_line (line) + char *line; +@{ + register int i; + COMMAND *command; + char *word; + + /* Isolate the command word. */ + i = 0; + while (line[i] && whitespace (line[i])) + i++; + word = line + i; + + while (line[i] && !whitespace (line[i])) + i++; + + if (line[i]) + line[i++] = '\0'; + + command = find_command (word); + + if (!command) + @{ + fprintf (stderr, "%s: No such command for FileMan.\n", word); + return (-1); + @} + + /* Get argument to command, if any. */ + while (whitespace (line[i])) + i++; + + word = line + i; + + /* Call the function. */ + return ((*(command->func)) (word)); +@} + +/* Look up NAME as the name of a command, and return a pointer to that + command. Return a NULL pointer if NAME isn't a command name. */ +COMMAND * +find_command (name) + char *name; +@{ + register int i; + + for (i = 0; commands[i].name; i++) + if (strcmp (name, commands[i].name) == 0) + return (&commands[i]); + + return ((COMMAND *)NULL); +@} + +/* Strip whitespace from the start and end of STRING. Return a pointer + into STRING. */ +char * +stripwhite (string) + char *string; +@{ + register char *s, *t; + + for (s = string; whitespace (*s); s++) + ; + + if (*s == 0) + return (s); + + t = s + strlen (s) - 1; + while (t > s && whitespace (*t)) + t--; + *++t = '\0'; + + return s; +@} + +/* **************************************************************** */ +/* */ +/* Interface to Readline Completion */ +/* */ +/* **************************************************************** */ + +char *command_generator __P((const char *, int)); +char **fileman_completion __P((const char *, int, int)); + +/* Tell the GNU Readline library how to complete. We want to try to + complete on command names if this is the first word in the line, or + on filenames if not. */ +initialize_readline () +@{ + /* Allow conditional parsing of the ~/.inputrc file. */ + rl_readline_name = "FileMan"; + + /* Tell the completer that we want a crack first. */ + rl_attempted_completion_function = fileman_completion; +@} + +/* Attempt to complete on the contents of TEXT. START and END + bound the region of rl_line_buffer that contains the word to + complete. TEXT is the word to complete. We can use the entire + contents of rl_line_buffer in case we want to do some simple + parsing. Returnthe array of matches, or NULL if there aren't any. */ +char ** +fileman_completion (text, start, end) + const char *text; + int start, end; +@{ + char **matches; + + matches = (char **)NULL; + + /* If this word is at the start of the line, then it is a command + to complete. Otherwise it is the name of a file in the current + directory. */ + if (start == 0) + matches = rl_completion_matches (text, command_generator); + + return (matches); +@} + +/* Generator function for command completion. STATE lets us + know whether to start from scratch; without any state + (i.e. STATE == 0), then we start at the top of the list. */ +char * +command_generator (text, state) + const char *text; + int state; +@{ + static int list_index, len; + char *name; + + /* If this is a new word to complete, initialize now. This + includes saving the length of TEXT for efficiency, and + initializing the index variable to 0. */ + if (!state) + @{ + list_index = 0; + len = strlen (text); + @} + + /* Return the next name which partially matches from the + command list. */ + while (name = commands[list_index].name) + @{ + list_index++; + + if (strncmp (name, text, len) == 0) + return (dupstr(name)); + @} + + /* If no names matched, then return NULL. */ + return ((char *)NULL); +@} + +/* **************************************************************** */ +/* */ +/* FileMan Commands */ +/* */ +/* **************************************************************** */ + +/* String to pass to system (). This is for the LIST, VIEW and RENAME + commands. */ +static char syscom[1024]; + +/* List the file(s) named in arg. */ +com_list (arg) + char *arg; +@{ + if (!arg) + arg = ""; + + sprintf (syscom, "ls -FClg %s", arg); + return (system (syscom)); +@} + +com_view (arg) + char *arg; +@{ + if (!valid_argument ("view", arg)) + return 1; + + sprintf (syscom, "more %s", arg); + return (system (syscom)); +@} + +com_rename (arg) + char *arg; +@{ + too_dangerous ("rename"); + return (1); +@} + +com_stat (arg) + char *arg; +@{ + struct stat finfo; + + if (!valid_argument ("stat", arg)) + return (1); + + if (stat (arg, &finfo) == -1) + @{ + perror (arg); + return (1); + @} + + printf ("Statistics for `%s':\n", arg); + + printf ("%s has %d link%s, and is %d byte%s in length.\n", arg, + finfo.st_nlink, + (finfo.st_nlink == 1) ? "" : "s", + finfo.st_size, + (finfo.st_size == 1) ? "" : "s"); + printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime)); + printf (" Last access at: %s", ctime (&finfo.st_atime)); + printf (" Last modified at: %s", ctime (&finfo.st_mtime)); + return (0); +@} + +com_delete (arg) + char *arg; +@{ + too_dangerous ("delete"); + return (1); +@} + +/* Print out help for ARG, or for all of the commands if ARG is + not present. */ +com_help (arg) + char *arg; +@{ + register int i; + int printed = 0; + + for (i = 0; commands[i].name; i++) + @{ + if (!*arg || (strcmp (arg, commands[i].name) == 0)) + @{ + printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc); + printed++; + @} + @} + + if (!printed) + @{ + printf ("No commands match `%s'. Possibilties are:\n", arg); + + for (i = 0; commands[i].name; i++) + @{ + /* Print in six columns. */ + if (printed == 6) + @{ + printed = 0; + printf ("\n"); + @} + + printf ("%s\t", commands[i].name); + printed++; + @} + + if (printed) + printf ("\n"); + @} + return (0); +@} + +/* Change to the directory ARG. */ +com_cd (arg) + char *arg; +@{ + if (chdir (arg) == -1) + @{ + perror (arg); + return 1; + @} + + com_pwd (""); + return (0); +@} + +/* Print out the current working directory. */ +com_pwd (ignore) + char *ignore; +@{ + char dir[1024], *s; + + s = getcwd (dir, sizeof(dir) - 1); + if (s == 0) + @{ + printf ("Error getting pwd: %s\n", dir); + return 1; + @} + + printf ("Current directory is %s\n", dir); + return 0; +@} + +/* The user wishes to quit using this program. Just set DONE + non-zero. */ +com_quit (arg) + char *arg; +@{ + done = 1; + return (0); +@} + +/* Function which tells you that you can't do this. */ +too_dangerous (caller) + char *caller; +@{ + fprintf (stderr, + "%s: Too dangerous for me to distribute.\n", + caller); + fprintf (stderr, "Write it yourself.\n"); +@} + +/* Return non-zero if ARG is a valid argument for CALLER, + else print an error message and return zero. */ +int +valid_argument (caller, arg) + char *caller, *arg; +@{ + if (!arg || !*arg) + @{ + fprintf (stderr, "%s: Argument required.\n", caller); + return (0); + @} + + return (1); +@} +@end smallexample diff --git a/readline/doc/rluser.texi b/readline/doc/rluser.texi new file mode 100644 index 0000000..478b41f --- /dev/null +++ b/readline/doc/rluser.texi @@ -0,0 +1,1846 @@ +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rluser.info +@comment %**end of header (This is for running Texinfo on a region.) +@setchapternewpage odd + +@ignore +This file documents the end user interface to the GNU command line +editing features. It is to be an appendix to manuals for programs which +use these features. There is a document entitled "readline.texinfo" +which contains both end-user and programmer documentation for the +GNU Readline Library. + +Copyright (C) 1988-2005 Free Software Foundation, Inc. + +Authored by Brian Fox and Chet Ramey. + +Permission is granted to process this file through Tex and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +GNU Copyright statement is available to the distributee, and provided that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end ignore + +@comment If you are including this manual as an appendix, then set the +@comment variable readline-appendix. + +@ifclear BashFeatures +@defcodeindex bt +@end ifclear + +@node Command Line Editing +@chapter Command Line Editing + +This chapter describes the basic features of the @sc{gnu} +command line editing interface. +@ifset BashFeatures +Command line editing is provided by the Readline library, which is +used by several different programs, including Bash. +@end ifset + +@menu +* Introduction and Notation:: Notation used in this text. +* Readline Interaction:: The minimum set of commands for editing a line. +* Readline Init File:: Customizing Readline from a user's view. +* Bindable Readline Commands:: A description of most of the Readline commands + available for binding +* Readline vi Mode:: A short description of how to make Readline + behave like the vi editor. +@ifset BashFeatures +* Programmable Completion:: How to specify the possible completions for + a specific command. +* Programmable Completion Builtins:: Builtin commands to specify how to + complete arguments for a particular command. +@end ifset +@end menu + +@node Introduction and Notation +@section Introduction to Line Editing + +The following paragraphs describe the notation used to represent +keystrokes. + +The text @kbd{C-k} is read as `Control-K' and describes the character +produced when the @key{k} key is pressed while the Control key +is depressed. + +The text @kbd{M-k} is read as `Meta-K' and describes the character +produced when the Meta key (if you have one) is depressed, and the @key{k} +key is pressed. +The Meta key is labeled @key{ALT} on many keyboards. +On keyboards with two keys labeled @key{ALT} (usually to either side of +the space bar), the @key{ALT} on the left side is generally set to +work as a Meta key. +The @key{ALT} key on the right may also be configured to work as a +Meta key or may be configured as some other modifier, such as a +Compose key for typing accented characters. + +If you do not have a Meta or @key{ALT} key, or another key working as +a Meta key, the identical keystroke can be generated by typing @key{ESC} +@emph{first}, and then typing @key{k}. +Either process is known as @dfn{metafying} the @key{k} key. + +The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the +character produced by @dfn{metafying} @kbd{C-k}. + +In addition, several keys have their own names. Specifically, +@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all +stand for themselves when seen in this text, or in an init file +(@pxref{Readline Init File}). +If your keyboard lacks a @key{LFD} key, typing @key{C-j} will +produce the desired character. +The @key{RET} key may be labeled @key{Return} or @key{Enter} on +some keyboards. + +@node Readline Interaction +@section Readline Interaction +@cindex interaction, readline + +Often during an interactive session you type in a long line of text, +only to notice that the first word on the line is misspelled. The +Readline library gives you a set of commands for manipulating the text +as you type it in, allowing you to just fix your typo, and not forcing +you to retype the majority of the line. Using these editing commands, +you move the cursor to the place that needs correction, and delete or +insert the text of the corrections. Then, when you are satisfied with +the line, you simply press @key{RET}. You do not have to be at the +end of the line to press @key{RET}; the entire line is accepted +regardless of the location of the cursor within the line. + +@menu +* Readline Bare Essentials:: The least you need to know about Readline. +* Readline Movement Commands:: Moving about the input line. +* Readline Killing Commands:: How to delete text, and how to get it back! +* Readline Arguments:: Giving numeric arguments to commands. +* Searching:: Searching through previous lines. +@end menu + +@node Readline Bare Essentials +@subsection Readline Bare Essentials +@cindex notation, readline +@cindex command editing +@cindex editing command lines + +In order to enter characters into the line, simply type them. The typed +character appears where the cursor was, and then the cursor moves one +space to the right. If you mistype a character, you can use your +erase character to back up and delete the mistyped character. + +Sometimes you may mistype a character, and +not notice the error until you have typed several other characters. In +that case, you can type @kbd{C-b} to move the cursor to the left, and then +correct your mistake. Afterwards, you can move the cursor to the right +with @kbd{C-f}. + +When you add text in the middle of a line, you will notice that characters +to the right of the cursor are `pushed over' to make room for the text +that you have inserted. Likewise, when you delete text behind the cursor, +characters to the right of the cursor are `pulled back' to fill in the +blank space created by the removal of the text. A list of the bare +essentials for editing the text of an input line follows. + +@table @asis +@item @kbd{C-b} +Move back one character. +@item @kbd{C-f} +Move forward one character. +@item @key{DEL} or @key{Backspace} +Delete the character to the left of the cursor. +@item @kbd{C-d} +Delete the character underneath the cursor. +@item @w{Printing characters} +Insert the character into the line at the cursor. +@item @kbd{C-_} or @kbd{C-x C-u} +Undo the last editing command. You can undo all the way back to an +empty line. +@end table + +@noindent +(Depending on your configuration, the @key{Backspace} key be set to +delete the character to the left of the cursor and the @key{DEL} key set +to delete the character underneath the cursor, like @kbd{C-d}, rather +than the character to the left of the cursor.) + +@node Readline Movement Commands +@subsection Readline Movement Commands + + +The above table describes the most basic keystrokes that you need +in order to do editing of the input line. For your convenience, many +other commands have been added in addition to @kbd{C-b}, @kbd{C-f}, +@kbd{C-d}, and @key{DEL}. Here are some commands for moving more rapidly +about the line. + +@table @kbd +@item C-a +Move to the start of the line. +@item C-e +Move to the end of the line. +@item M-f +Move forward a word, where a word is composed of letters and digits. +@item M-b +Move backward a word. +@item C-l +Clear the screen, reprinting the current line at the top. +@end table + +Notice how @kbd{C-f} moves forward a character, while @kbd{M-f} moves +forward a word. It is a loose convention that control keystrokes +operate on characters while meta keystrokes operate on words. + +@node Readline Killing Commands +@subsection Readline Killing Commands + +@cindex killing text +@cindex yanking text + +@dfn{Killing} text means to delete the text from the line, but to save +it away for later use, usually by @dfn{yanking} (re-inserting) +it back into the line. +(`Cut' and `paste' are more recent jargon for `kill' and `yank'.) + +If the description for a command says that it `kills' text, then you can +be sure that you can get the text back in a different (or the same) +place later. + +When you use a kill command, the text is saved in a @dfn{kill-ring}. +Any number of consecutive kills save all of the killed text together, so +that when you yank it back, you get it all. The kill +ring is not line specific; the text that you killed on a previously +typed line is available to be yanked back later, when you are typing +another line. +@cindex kill ring + +Here is the list of commands for killing text. + +@table @kbd +@item C-k +Kill the text from the current cursor position to the end of the line. + +@item M-d +Kill from the cursor to the end of the current word, or, if between +words, to the end of the next word. +Word boundaries are the same as those used by @kbd{M-f}. + +@item M-@key{DEL} +Kill from the cursor the start of the current word, or, if between +words, to the start of the previous word. +Word boundaries are the same as those used by @kbd{M-b}. + +@item C-w +Kill from the cursor to the previous whitespace. This is different than +@kbd{M-@key{DEL}} because the word boundaries differ. + +@end table + +Here is how to @dfn{yank} the text back into the line. Yanking +means to copy the most-recently-killed text from the kill buffer. + +@table @kbd +@item C-y +Yank the most recently killed text back into the buffer at the cursor. + +@item M-y +Rotate the kill-ring, and yank the new top. You can only do this if +the prior command is @kbd{C-y} or @kbd{M-y}. +@end table + +@node Readline Arguments +@subsection Readline Arguments + +You can pass numeric arguments to Readline commands. Sometimes the +argument acts as a repeat count, other times it is the @i{sign} of the +argument that is significant. If you pass a negative argument to a +command which normally acts in a forward direction, that command will +act in a backward direction. For example, to kill text back to the +start of the line, you might type @samp{M-- C-k}. + +The general way to pass numeric arguments to a command is to type meta +digits before the command. If the first `digit' typed is a minus +sign (@samp{-}), then the sign of the argument will be negative. Once +you have typed one meta digit to get the argument started, you can type +the remainder of the digits, and then the command. For example, to give +the @kbd{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}, +which will delete the next ten characters on the input line. + +@node Searching +@subsection Searching for Commands in the History + +Readline provides commands for searching through the command history +@ifset BashFeatures +(@pxref{Bash History Facilities}) +@end ifset +for lines containing a specified string. +There are two search modes: @dfn{incremental} and @dfn{non-incremental}. + +Incremental searches begin before the user has finished typing the +search string. +As each character of the search string is typed, Readline displays +the next entry from the history matching the string typed so far. +An incremental search requires only as many characters as needed to +find the desired history entry. +To search backward in the history for a particular string, type +@kbd{C-r}. Typing @kbd{C-s} searches forward through the history. +The characters present in the value of the @code{isearch-terminators} variable +are used to terminate an incremental search. +If that variable has not been assigned a value, the @key{ESC} and +@kbd{C-J} characters will terminate an incremental search. +@kbd{C-g} will abort an incremental search and restore the original line. +When the search is terminated, the history entry containing the +search string becomes the current line. + +To find other matching entries in the history list, type @kbd{C-r} or +@kbd{C-s} as appropriate. +This will search backward or forward in the history for the next +entry matching the search string typed so far. +Any other key sequence bound to a Readline command will terminate +the search and execute that command. +For instance, a @key{RET} will terminate the search and accept +the line, thereby executing the command from the history list. +A movement command will terminate the search, make the last line found +the current line, and begin editing. + +Readline remembers the last incremental search string. If two +@kbd{C-r}s are typed without any intervening characters defining a new +search string, any remembered search string is used. + +Non-incremental searches read the entire search string before starting +to search for matching history lines. The search string may be +typed by the user or be part of the contents of the current line. + +@node Readline Init File +@section Readline Init File +@cindex initialization file, readline + +Although the Readline library comes with a set of Emacs-like +keybindings installed by default, it is possible to use a different set +of keybindings. +Any user can customize programs that use Readline by putting +commands in an @dfn{inputrc} file, conventionally in his home directory. +The name of this +@ifset BashFeatures +file is taken from the value of the shell variable @env{INPUTRC}. If +@end ifset +@ifclear BashFeatures +file is taken from the value of the environment variable @env{INPUTRC}. If +@end ifclear +that variable is unset, the default is @file{~/.inputrc}. + +When a program which uses the Readline library starts up, the +init file is read, and the key bindings are set. + +In addition, the @code{C-x C-r} command re-reads this init file, thus +incorporating any changes that you might have made to it. + +@menu +* Readline Init File Syntax:: Syntax for the commands in the inputrc file. + +* Conditional Init Constructs:: Conditional key bindings in the inputrc file. + +* Sample Init File:: An example inputrc file. +@end menu + +@node Readline Init File Syntax +@subsection Readline Init File Syntax + +There are only a few basic constructs allowed in the +Readline init file. Blank lines are ignored. +Lines beginning with a @samp{#} are comments. +Lines beginning with a @samp{$} indicate conditional +constructs (@pxref{Conditional Init Constructs}). Other lines +denote variable settings and key bindings. + +@table @asis +@item Variable Settings +You can modify the run-time behavior of Readline by +altering the values of variables in Readline +using the @code{set} command within the init file. +The syntax is simple: + +@example +set @var{variable} @var{value} +@end example + +@noindent +Here, for example, is how to +change from the default Emacs-like key binding to use +@code{vi} line editing commands: + +@example +set editing-mode vi +@end example + +Variable names and values, where appropriate, are recognized without regard +to case. Unrecognized variable names are ignored. + +Boolean variables (those that can be set to on or off) are set to on if +the value is null or empty, @var{on} (case-insensitive), or 1. Any other +value results in the variable being set to off. + +@ifset BashFeatures +The @w{@code{bind -V}} command lists the current Readline variable names +and values. @xref{Bash Builtins}. +@end ifset + +A great deal of run-time behavior is changeable with the following +variables. + +@cindex variables, readline +@table @code + +@item bell-style +@vindex bell-style +Controls what happens when Readline wants to ring the terminal bell. +If set to @samp{none}, Readline never rings the bell. If set to +@samp{visible}, Readline uses a visible bell if one is available. +If set to @samp{audible} (the default), Readline attempts to ring +the terminal's bell. + +@item bind-tty-special-chars +@vindex bind-tty-special-chars +If set to @samp{on}, Readline attempts to bind the control characters +treated specially by the kernel's terminal driver to their Readline +equivalents. + +@item comment-begin +@vindex comment-begin +The string to insert at the beginning of the line when the +@code{insert-comment} command is executed. The default value +is @code{"#"}. + +@item completion-ignore-case +If set to @samp{on}, Readline performs filename matching and completion +in a case-insensitive fashion. +The default value is @samp{off}. + +@item completion-query-items +@vindex completion-query-items +The number of possible completions that determines when the user is +asked whether the list of possibilities should be displayed. +If the number of possible completions is greater than this value, +Readline will ask the user whether or not he wishes to view +them; otherwise, they are simply listed. +This variable must be set to an integer value greater than or equal to 0. +A negative value means Readline should never ask. +The default limit is @code{100}. + +@item convert-meta +@vindex convert-meta +If set to @samp{on}, Readline will convert characters with the +eighth bit set to an @sc{ascii} key sequence by stripping the eighth +bit and prefixing an @key{ESC} character, converting them to a +meta-prefixed key sequence. The default value is @samp{on}. + +@item disable-completion +@vindex disable-completion +If set to @samp{On}, Readline will inhibit word completion. +Completion characters will be inserted into the line as if they had +been mapped to @code{self-insert}. The default is @samp{off}. + +@item editing-mode +@vindex editing-mode +The @code{editing-mode} variable controls which default set of +key bindings is used. By default, Readline starts up in Emacs editing +mode, where the keystrokes are most similar to Emacs. This variable can be +set to either @samp{emacs} or @samp{vi}. + +@item enable-keypad +@vindex enable-keypad +When set to @samp{on}, Readline will try to enable the application +keypad when it is called. Some systems need this to enable the +arrow keys. The default is @samp{off}. + +@item expand-tilde +@vindex expand-tilde +If set to @samp{on}, tilde expansion is performed when Readline +attempts word completion. The default is @samp{off}. + +@item history-preserve-point +@vindex history-preserve-point +If set to @samp{on}, the history code attempts to place point at the +same location on each history line retrieved with @code{previous-history} +or @code{next-history}. The default is @samp{off}. + +@item horizontal-scroll-mode +@vindex horizontal-scroll-mode +This variable can be set to either @samp{on} or @samp{off}. Setting it +to @samp{on} means that the text of the lines being edited will scroll +horizontally on a single screen line when they are longer than the width +of the screen, instead of wrapping onto a new screen line. By default, +this variable is set to @samp{off}. + +@item input-meta +@vindex input-meta +@vindex meta-flag +If set to @samp{on}, Readline will enable eight-bit input (it +will not clear the eighth bit in the characters it reads), +regardless of what the terminal claims it can support. The +default value is @samp{off}. The name @code{meta-flag} is a +synonym for this variable. + +@item isearch-terminators +@vindex isearch-terminators +The string of characters that should terminate an incremental search without +subsequently executing the character as a command (@pxref{Searching}). +If this variable has not been given a value, the characters @key{ESC} and +@kbd{C-J} will terminate an incremental search. + +@item keymap +@vindex keymap +Sets Readline's idea of the current keymap for key binding commands. +Acceptable @code{keymap} names are +@code{emacs}, +@code{emacs-standard}, +@code{emacs-meta}, +@code{emacs-ctlx}, +@code{vi}, +@code{vi-move}, +@code{vi-command}, and +@code{vi-insert}. +@code{vi} is equivalent to @code{vi-command}; @code{emacs} is +equivalent to @code{emacs-standard}. The default value is @code{emacs}. +The value of the @code{editing-mode} variable also affects the +default keymap. + +@item mark-directories +If set to @samp{on}, completed directory names have a slash +appended. The default is @samp{on}. + +@item mark-modified-lines +@vindex mark-modified-lines +This variable, when set to @samp{on}, causes Readline to display an +asterisk (@samp{*}) at the start of history lines which have been modified. +This variable is @samp{off} by default. + +@item mark-symlinked-directories +@vindex mark-symlinked-directories +If set to @samp{on}, completed names which are symbolic links +to directories have a slash appended (subject to the value of +@code{mark-directories}). +The default is @samp{off}. + +@item match-hidden-files +@vindex match-hidden-files +This variable, when set to @samp{on}, causes Readline to match files whose +names begin with a @samp{.} (hidden files) when performing filename +completion, unless the leading @samp{.} is +supplied by the user in the filename to be completed. +This variable is @samp{on} by default. + +@item output-meta +@vindex output-meta +If set to @samp{on}, Readline will display characters with the +eighth bit set directly rather than as a meta-prefixed escape +sequence. The default is @samp{off}. + +@item page-completions +@vindex page-completions +If set to @samp{on}, Readline uses an internal @code{more}-like pager +to display a screenful of possible completions at a time. +This variable is @samp{on} by default. + +@item print-completions-horizontally +If set to @samp{on}, Readline will display completions with matches +sorted horizontally in alphabetical order, rather than down the screen. +The default is @samp{off}. + +@item show-all-if-ambiguous +@vindex show-all-if-ambiguous +This alters the default behavior of the completion functions. If +set to @samp{on}, +words which have more than one possible completion cause the +matches to be listed immediately instead of ringing the bell. +The default value is @samp{off}. + +@item show-all-if-unmodified +@vindex show-all-if-unmodified +This alters the default behavior of the completion functions in +a fashion similar to @var{show-all-if-ambiguous}. +If set to @samp{on}, +words which have more than one possible completion without any +possible partial completion (the possible completions don't share +a common prefix) cause the matches to be listed immediately instead +of ringing the bell. +The default value is @samp{off}. + +@item visible-stats +@vindex visible-stats +If set to @samp{on}, a character denoting a file's type +is appended to the filename when listing possible +completions. The default is @samp{off}. + +@end table + +@item Key Bindings +The syntax for controlling key bindings in the init file is +simple. First you need to find the name of the command that you +want to change. The following sections contain tables of the command +name, the default keybinding, if any, and a short description of what +the command does. + +Once you know the name of the command, simply place on a line +in the init file the name of the key +you wish to bind the command to, a colon, and then the name of the +command. The name of the key +can be expressed in different ways, depending on what you find most +comfortable. + +In addition to command names, readline allows keys to be bound +to a string that is inserted when the key is pressed (a @var{macro}). + +@ifset BashFeatures +The @w{@code{bind -p}} command displays Readline function names and +bindings in a format that can put directly into an initialization file. +@xref{Bash Builtins}. +@end ifset + +@table @asis +@item @w{@var{keyname}: @var{function-name} or @var{macro}} +@var{keyname} is the name of a key spelled out in English. For example: +@example +Control-u: universal-argument +Meta-Rubout: backward-kill-word +Control-o: "> output" +@end example + +In the above example, @kbd{C-u} is bound to the function +@code{universal-argument}, +@kbd{M-DEL} is bound to the function @code{backward-kill-word}, and +@kbd{C-o} is bound to run the macro +expressed on the right hand side (that is, to insert the text +@samp{> output} into the line). + +A number of symbolic character names are recognized while +processing this key binding syntax: +@var{DEL}, +@var{ESC}, +@var{ESCAPE}, +@var{LFD}, +@var{NEWLINE}, +@var{RET}, +@var{RETURN}, +@var{RUBOUT}, +@var{SPACE}, +@var{SPC}, +and +@var{TAB}. + +@item @w{"@var{keyseq}": @var{function-name} or @var{macro}} +@var{keyseq} differs from @var{keyname} above in that strings +denoting an entire key sequence can be specified, by placing +the key sequence in double quotes. Some @sc{gnu} Emacs style key +escapes can be used, as in the following example, but the +special character names are not recognized. + +@example +"\C-u": universal-argument +"\C-x\C-r": re-read-init-file +"\e[11~": "Function Key 1" +@end example + +In the above example, @kbd{C-u} is again bound to the function +@code{universal-argument} (just as it was in the first example), +@samp{@kbd{C-x} @kbd{C-r}} is bound to the function @code{re-read-init-file}, +and @samp{@key{ESC} @key{[} @key{1} @key{1} @key{~}} is bound to insert +the text @samp{Function Key 1}. + +@end table + +The following @sc{gnu} Emacs style escape sequences are available when +specifying key sequences: + +@table @code +@item @kbd{\C-} +control prefix +@item @kbd{\M-} +meta prefix +@item @kbd{\e} +an escape character +@item @kbd{\\} +backslash +@item @kbd{\"} +@key{"}, a double quotation mark +@item @kbd{\'} +@key{'}, a single quote or apostrophe +@end table + +In addition to the @sc{gnu} Emacs style escape sequences, a second +set of backslash escapes is available: + +@table @code +@item \a +alert (bell) +@item \b +backspace +@item \d +delete +@item \f +form feed +@item \n +newline +@item \r +carriage return +@item \t +horizontal tab +@item \v +vertical tab +@item \@var{nnn} +the eight-bit character whose value is the octal value @var{nnn} +(one to three digits) +@item \x@var{HH} +the eight-bit character whose value is the hexadecimal value @var{HH} +(one or two hex digits) +@end table + +When entering the text of a macro, single or double quotes must +be used to indicate a macro definition. +Unquoted text is assumed to be a function name. +In the macro body, the backslash escapes described above are expanded. +Backslash will quote any other character in the macro text, +including @samp{"} and @samp{'}. +For example, the following binding will make @samp{@kbd{C-x} \} +insert a single @samp{\} into the line: +@example +"\C-x\\": "\\" +@end example + +@end table + +@node Conditional Init Constructs +@subsection Conditional Init Constructs + +Readline implements a facility similar in spirit to the conditional +compilation features of the C preprocessor which allows key +bindings and variable settings to be performed as the result +of tests. There are four parser directives used. + +@table @code +@item $if +The @code{$if} construct allows bindings to be made based on the +editing mode, the terminal being used, or the application using +Readline. The text of the test extends to the end of the line; +no characters are required to isolate it. + +@table @code +@item mode +The @code{mode=} form of the @code{$if} directive is used to test +whether Readline is in @code{emacs} or @code{vi} mode. +This may be used in conjunction +with the @samp{set keymap} command, for instance, to set bindings in +the @code{emacs-standard} and @code{emacs-ctlx} keymaps only if +Readline is starting out in @code{emacs} mode. + +@item term +The @code{term=} form may be used to include terminal-specific +key bindings, perhaps to bind the key sequences output by the +terminal's function keys. The word on the right side of the +@samp{=} is tested against both the full name of the terminal and +the portion of the terminal name before the first @samp{-}. This +allows @code{sun} to match both @code{sun} and @code{sun-cmd}, +for instance. + +@item application +The @var{application} construct is used to include +application-specific settings. Each program using the Readline +library sets the @var{application name}, and you can test for +a particular value. +This could be used to bind key sequences to functions useful for +a specific program. For instance, the following command adds a +key sequence that quotes the current or previous word in Bash: +@example +$if Bash +# Quote the current or previous word +"\C-xq": "\eb\"\ef\"" +$endif +@end example +@end table + +@item $endif +This command, as seen in the previous example, terminates an +@code{$if} command. + +@item $else +Commands in this branch of the @code{$if} directive are executed if +the test fails. + +@item $include +This directive takes a single filename as an argument and reads commands +and bindings from that file. +For example, the following directive reads from @file{/etc/inputrc}: +@example +$include /etc/inputrc +@end example +@end table + +@node Sample Init File +@subsection Sample Init File + +Here is an example of an @var{inputrc} file. This illustrates key +binding, variable assignment, and conditional syntax. + +@example +@page +# This file controls the behaviour of line input editing for +# programs that use the GNU Readline library. Existing +# programs include FTP, Bash, and GDB. +# +# You can re-read the inputrc file with C-x C-r. +# Lines beginning with '#' are comments. +# +# First, include any systemwide bindings and variable +# assignments from /etc/Inputrc +$include /etc/Inputrc + +# +# Set various bindings for emacs mode. + +set editing-mode emacs + +$if mode=emacs + +Meta-Control-h: backward-kill-word Text after the function name is ignored + +# +# Arrow keys in keypad mode +# +#"\M-OD": backward-char +#"\M-OC": forward-char +#"\M-OA": previous-history +#"\M-OB": next-history +# +# Arrow keys in ANSI mode +# +"\M-[D": backward-char +"\M-[C": forward-char +"\M-[A": previous-history +"\M-[B": next-history +# +# Arrow keys in 8 bit keypad mode +# +#"\M-\C-OD": backward-char +#"\M-\C-OC": forward-char +#"\M-\C-OA": previous-history +#"\M-\C-OB": next-history +# +# Arrow keys in 8 bit ANSI mode +# +#"\M-\C-[D": backward-char +#"\M-\C-[C": forward-char +#"\M-\C-[A": previous-history +#"\M-\C-[B": next-history + +C-q: quoted-insert + +$endif + +# An old-style binding. This happens to be the default. +TAB: complete + +# Macros that are convenient for shell interaction +$if Bash +# edit the path +"\C-xp": "PATH=$@{PATH@}\e\C-e\C-a\ef\C-f" +# prepare to type a quoted word -- +# insert open and close double quotes +# and move to just after the open quote +"\C-x\"": "\"\"\C-b" +# insert a backslash (testing backslash escapes +# in sequences and macros) +"\C-x\\": "\\" +# Quote the current or previous word +"\C-xq": "\eb\"\ef\"" +# Add a binding to refresh the line, which is unbound +"\C-xr": redraw-current-line +# Edit variable on current line. +"\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" +$endif + +# use a visible bell if one is available +set bell-style visible + +# don't strip characters to 7 bits when reading +set input-meta on + +# allow iso-latin1 characters to be inserted rather +# than converted to prefix-meta sequences +set convert-meta off + +# display characters with the eighth bit set directly +# rather than as meta-prefixed characters +set output-meta on + +# if there are more than 150 possible completions for +# a word, ask the user if he wants to see all of them +set completion-query-items 150 + +# For FTP +$if Ftp +"\C-xg": "get \M-?" +"\C-xt": "put \M-?" +"\M-.": yank-last-arg +$endif +@end example + +@node Bindable Readline Commands +@section Bindable Readline Commands + +@menu +* Commands For Moving:: Moving about the line. +* Commands For History:: Getting at previous lines. +* Commands For Text:: Commands for changing text. +* Commands For Killing:: Commands for killing and yanking. +* Numeric Arguments:: Specifying numeric arguments, repeat counts. +* Commands For Completion:: Getting Readline to do the typing for you. +* Keyboard Macros:: Saving and re-executing typed characters +* Miscellaneous Commands:: Other miscellaneous commands. +@end menu + +This section describes Readline commands that may be bound to key +sequences. +@ifset BashFeatures +You can list your key bindings by executing +@w{@code{bind -P}} or, for a more terse format, suitable for an +@var{inputrc} file, @w{@code{bind -p}}. (@xref{Bash Builtins}.) +@end ifset +Command names without an accompanying key sequence are unbound by default. + +In the following descriptions, @dfn{point} refers to the current cursor +position, and @dfn{mark} refers to a cursor position saved by the +@code{set-mark} command. +The text between the point and mark is referred to as the @dfn{region}. + +@node Commands For Moving +@subsection Commands For Moving +@ftable @code +@item beginning-of-line (C-a) +Move to the start of the current line. + +@item end-of-line (C-e) +Move to the end of the line. + +@item forward-char (C-f) +Move forward a character. + +@item backward-char (C-b) +Move back a character. + +@item forward-word (M-f) +Move forward to the end of the next word. Words are composed of +letters and digits. + +@item backward-word (M-b) +Move back to the start of the current or previous word. Words are +composed of letters and digits. + +@item clear-screen (C-l) +Clear the screen and redraw the current line, +leaving the current line at the top of the screen. + +@item redraw-current-line () +Refresh the current line. By default, this is unbound. + +@end ftable + +@node Commands For History +@subsection Commands For Manipulating The History + +@ftable @code +@item accept-line (Newline or Return) +@ifset BashFeatures +Accept the line regardless of where the cursor is. +If this line is +non-empty, add it to the history list according to the setting of +the @env{HISTCONTROL} and @env{HISTIGNORE} variables. +If this line is a modified history line, then restore the history line +to its original state. +@end ifset +@ifclear BashFeatures +Accept the line regardless of where the cursor is. +If this line is +non-empty, it may be added to the history list for future recall with +@code{add_history()}. +If this line is a modified history line, the history line is restored +to its original state. +@end ifclear + +@item previous-history (C-p) +Move `back' through the history list, fetching the previous command. + +@item next-history (C-n) +Move `forward' through the history list, fetching the next command. + +@item beginning-of-history (M-<) +Move to the first line in the history. + +@item end-of-history (M->) +Move to the end of the input history, i.e., the line currently +being entered. + +@item reverse-search-history (C-r) +Search backward starting at the current line and moving `up' through +the history as necessary. This is an incremental search. + +@item forward-search-history (C-s) +Search forward starting at the current line and moving `down' through +the the history as necessary. This is an incremental search. + +@item non-incremental-reverse-search-history (M-p) +Search backward starting at the current line and moving `up' +through the history as necessary using a non-incremental search +for a string supplied by the user. + +@item non-incremental-forward-search-history (M-n) +Search forward starting at the current line and moving `down' +through the the history as necessary using a non-incremental search +for a string supplied by the user. + +@item history-search-forward () +Search forward through the history for the string of characters +between the start of the current line and the point. +This is a non-incremental search. +By default, this command is unbound. + +@item history-search-backward () +Search backward through the history for the string of characters +between the start of the current line and the point. This +is a non-incremental search. By default, this command is unbound. + +@item yank-nth-arg (M-C-y) +Insert the first argument to the previous command (usually +the second word on the previous line) at point. +With an argument @var{n}, +insert the @var{n}th word from the previous command (the words +in the previous command begin with word 0). A negative argument +inserts the @var{n}th word from the end of the previous command. +Once the argument @var{n} is computed, the argument is extracted +as if the @samp{!@var{n}} history expansion had been specified. + +@item yank-last-arg (M-. or M-_) +Insert last argument to the previous command (the last word of the +previous history entry). With an +argument, behave exactly like @code{yank-nth-arg}. +Successive calls to @code{yank-last-arg} move back through the history +list, inserting the last argument of each line in turn. +The history expansion facilities are used to extract the last argument, +as if the @samp{!$} history expansion had been specified. + +@end ftable + +@node Commands For Text +@subsection Commands For Changing Text + +@ftable @code +@item delete-char (C-d) +Delete the character at point. If point is at the +beginning of the line, there are no characters in the line, and +the last character typed was not bound to @code{delete-char}, then +return @sc{eof}. + +@item backward-delete-char (Rubout) +Delete the character behind the cursor. A numeric argument means +to kill the characters instead of deleting them. + +@item forward-backward-delete-char () +Delete the character under the cursor, unless the cursor is at the +end of the line, in which case the character behind the cursor is +deleted. By default, this is not bound to a key. + +@item quoted-insert (C-q or C-v) +Add the next character typed to the line verbatim. This is +how to insert key sequences like @kbd{C-q}, for example. + +@ifclear BashFeatures +@item tab-insert (M-@key{TAB}) +Insert a tab character. +@end ifclear + +@item self-insert (a, b, A, 1, !, @dots{}) +Insert yourself. + +@item transpose-chars (C-t) +Drag the character before the cursor forward over +the character at the cursor, moving the +cursor forward as well. If the insertion point +is at the end of the line, then this +transposes the last two characters of the line. +Negative arguments have no effect. + +@item transpose-words (M-t) +Drag the word before point past the word after point, +moving point past that word as well. +If the insertion point is at the end of the line, this transposes +the last two words on the line. + +@item upcase-word (M-u) +Uppercase the current (or following) word. With a negative argument, +uppercase the previous word, but do not move the cursor. + +@item downcase-word (M-l) +Lowercase the current (or following) word. With a negative argument, +lowercase the previous word, but do not move the cursor. + +@item capitalize-word (M-c) +Capitalize the current (or following) word. With a negative argument, +capitalize the previous word, but do not move the cursor. + +@item overwrite-mode () +Toggle overwrite mode. With an explicit positive numeric argument, +switches to overwrite mode. With an explicit non-positive numeric +argument, switches to insert mode. This command affects only +@code{emacs} mode; @code{vi} mode does overwrite differently. +Each call to @code{readline()} starts in insert mode. + +In overwrite mode, characters bound to @code{self-insert} replace +the text at point rather than pushing the text to the right. +Characters bound to @code{backward-delete-char} replace the character +before point with a space. + +By default, this command is unbound. + +@end ftable + +@node Commands For Killing +@subsection Killing And Yanking + +@ftable @code + +@item kill-line (C-k) +Kill the text from point to the end of the line. + +@item backward-kill-line (C-x Rubout) +Kill backward to the beginning of the line. + +@item unix-line-discard (C-u) +Kill backward from the cursor to the beginning of the current line. + +@item kill-whole-line () +Kill all characters on the current line, no matter where point is. +By default, this is unbound. + +@item kill-word (M-d) +Kill from point to the end of the current word, or if between +words, to the end of the next word. +Word boundaries are the same as @code{forward-word}. + +@item backward-kill-word (M-@key{DEL}) +Kill the word behind point. +Word boundaries are the same as @code{backward-word}. + +@item unix-word-rubout (C-w) +Kill the word behind point, using white space as a word boundary. +The killed text is saved on the kill-ring. + +@item unix-filename-rubout () +Kill the word behind point, using white space and the slash character +as the word boundaries. +The killed text is saved on the kill-ring. + +@item delete-horizontal-space () +Delete all spaces and tabs around point. By default, this is unbound. + +@item kill-region () +Kill the text in the current region. +By default, this command is unbound. + +@item copy-region-as-kill () +Copy the text in the region to the kill buffer, so it can be yanked +right away. By default, this command is unbound. + +@item copy-backward-word () +Copy the word before point to the kill buffer. +The word boundaries are the same as @code{backward-word}. +By default, this command is unbound. + +@item copy-forward-word () +Copy the word following point to the kill buffer. +The word boundaries are the same as @code{forward-word}. +By default, this command is unbound. + +@item yank (C-y) +Yank the top of the kill ring into the buffer at point. + +@item yank-pop (M-y) +Rotate the kill-ring, and yank the new top. You can only do this if +the prior command is @code{yank} or @code{yank-pop}. +@end ftable + +@node Numeric Arguments +@subsection Specifying Numeric Arguments +@ftable @code + +@item digit-argument (@kbd{M-0}, @kbd{M-1}, @dots{} @kbd{M--}) +Add this digit to the argument already accumulating, or start a new +argument. @kbd{M--} starts a negative argument. + +@item universal-argument () +This is another way to specify an argument. +If this command is followed by one or more digits, optionally with a +leading minus sign, those digits define the argument. +If the command is followed by digits, executing @code{universal-argument} +again ends the numeric argument, but is otherwise ignored. +As a special case, if this command is immediately followed by a +character that is neither a digit or minus sign, the argument count +for the next command is multiplied by four. +The argument count is initially one, so executing this function the +first time makes the argument count four, a second time makes the +argument count sixteen, and so on. +By default, this is not bound to a key. +@end ftable + +@node Commands For Completion +@subsection Letting Readline Type For You + +@ftable @code +@item complete (@key{TAB}) +Attempt to perform completion on the text before point. +The actual completion performed is application-specific. +@ifset BashFeatures +Bash attempts completion treating the text as a variable (if the +text begins with @samp{$}), username (if the text begins with +@samp{~}), hostname (if the text begins with @samp{@@}), or +command (including aliases and functions) in turn. If none +of these produces a match, filename completion is attempted. +@end ifset +@ifclear BashFeatures +The default is filename completion. +@end ifclear + +@item possible-completions (M-?) +List the possible completions of the text before point. + +@item insert-completions (M-*) +Insert all completions of the text before point that would have +been generated by @code{possible-completions}. + +@item menu-complete () +Similar to @code{complete}, but replaces the word to be completed +with a single match from the list of possible completions. +Repeated execution of @code{menu-complete} steps through the list +of possible completions, inserting each match in turn. +At the end of the list of completions, the bell is rung +(subject to the setting of @code{bell-style}) +and the original text is restored. +An argument of @var{n} moves @var{n} positions forward in the list +of matches; a negative argument may be used to move backward +through the list. +This command is intended to be bound to @key{TAB}, but is unbound +by default. + +@item delete-char-or-list () +Deletes the character under the cursor if not at the beginning or +end of the line (like @code{delete-char}). +If at the end of the line, behaves identically to +@code{possible-completions}. +This command is unbound by default. + +@ifset BashFeatures +@item complete-filename (M-/) +Attempt filename completion on the text before point. + +@item possible-filename-completions (C-x /) +List the possible completions of the text before point, +treating it as a filename. + +@item complete-username (M-~) +Attempt completion on the text before point, treating +it as a username. + +@item possible-username-completions (C-x ~) +List the possible completions of the text before point, +treating it as a username. + +@item complete-variable (M-$) +Attempt completion on the text before point, treating +it as a shell variable. + +@item possible-variable-completions (C-x $) +List the possible completions of the text before point, +treating it as a shell variable. + +@item complete-hostname (M-@@) +Attempt completion on the text before point, treating +it as a hostname. + +@item possible-hostname-completions (C-x @@) +List the possible completions of the text before point, +treating it as a hostname. + +@item complete-command (M-!) +Attempt completion on the text before point, treating +it as a command name. Command completion attempts to +match the text against aliases, reserved words, shell +functions, shell builtins, and finally executable filenames, +in that order. + +@item possible-command-completions (C-x !) +List the possible completions of the text before point, +treating it as a command name. + +@item dynamic-complete-history (M-@key{TAB}) +Attempt completion on the text before point, comparing +the text against lines from the history list for possible +completion matches. + +@item complete-into-braces (M-@{) +Perform filename completion and insert the list of possible completions +enclosed within braces so the list is available to the shell +(@pxref{Brace Expansion}). + +@end ifset +@end ftable + +@node Keyboard Macros +@subsection Keyboard Macros +@ftable @code + +@item start-kbd-macro (C-x () +Begin saving the characters typed into the current keyboard macro. + +@item end-kbd-macro (C-x )) +Stop saving the characters typed into the current keyboard macro +and save the definition. + +@item call-last-kbd-macro (C-x e) +Re-execute the last keyboard macro defined, by making the characters +in the macro appear as if typed at the keyboard. + +@end ftable + +@node Miscellaneous Commands +@subsection Some Miscellaneous Commands +@ftable @code + +@item re-read-init-file (C-x C-r) +Read in the contents of the @var{inputrc} file, and incorporate +any bindings or variable assignments found there. + +@item abort (C-g) +Abort the current editing command and +ring the terminal's bell (subject to the setting of +@code{bell-style}). + +@item do-uppercase-version (M-a, M-b, M-@var{x}, @dots{}) +If the metafied character @var{x} is lowercase, run the command +that is bound to the corresponding uppercase character. + +@item prefix-meta (@key{ESC}) +Metafy the next character typed. This is for keyboards +without a meta key. Typing @samp{@key{ESC} f} is equivalent to typing +@kbd{M-f}. + +@item undo (C-_ or C-x C-u) +Incremental undo, separately remembered for each line. + +@item revert-line (M-r) +Undo all changes made to this line. This is like executing the @code{undo} +command enough times to get back to the beginning. + +@ifset BashFeatures +@item tilde-expand (M-&) +@end ifset +@ifclear BashFeatures +@item tilde-expand (M-~) +@end ifclear +Perform tilde expansion on the current word. + +@item set-mark (C-@@) +Set the mark to the point. If a +numeric argument is supplied, the mark is set to that position. + +@item exchange-point-and-mark (C-x C-x) +Swap the point with the mark. The current cursor position is set to +the saved position, and the old cursor position is saved as the mark. + +@item character-search (C-]) +A character is read and point is moved to the next occurrence of that +character. A negative count searches for previous occurrences. + +@item character-search-backward (M-C-]) +A character is read and point is moved to the previous occurrence +of that character. A negative count searches for subsequent +occurrences. + +@item insert-comment (M-#) +Without a numeric argument, the value of the @code{comment-begin} +variable is inserted at the beginning of the current line. +If a numeric argument is supplied, this command acts as a toggle: if +the characters at the beginning of the line do not match the value +of @code{comment-begin}, the value is inserted, otherwise +the characters in @code{comment-begin} are deleted from the beginning of +the line. +In either case, the line is accepted as if a newline had been typed. +@ifset BashFeatures +The default value of @code{comment-begin} causes this command +to make the current line a shell comment. +If a numeric argument causes the comment character to be removed, the line +will be executed by the shell. +@end ifset + +@item dump-functions () +Print all of the functions and their key bindings to the +Readline output stream. If a numeric argument is supplied, +the output is formatted in such a way that it can be made part +of an @var{inputrc} file. This command is unbound by default. + +@item dump-variables () +Print all of the settable variables and their values to the +Readline output stream. If a numeric argument is supplied, +the output is formatted in such a way that it can be made part +of an @var{inputrc} file. This command is unbound by default. + +@item dump-macros () +Print all of the Readline key sequences bound to macros and the +strings they output. If a numeric argument is supplied, +the output is formatted in such a way that it can be made part +of an @var{inputrc} file. This command is unbound by default. + +@ifset BashFeatures +@item glob-complete-word (M-g) +The word before point is treated as a pattern for pathname expansion, +with an asterisk implicitly appended. This pattern is used to +generate a list of matching file names for possible completions. + +@item glob-expand-word (C-x *) +The word before point is treated as a pattern for pathname expansion, +and the list of matching file names is inserted, replacing the word. +If a numeric argument is supplied, a @samp{*} is appended before +pathname expansion. + +@item glob-list-expansions (C-x g) +The list of expansions that would have been generated by +@code{glob-expand-word} is displayed, and the line is redrawn. +If a numeric argument is supplied, a @samp{*} is appended before +pathname expansion. + +@item display-shell-version (C-x C-v) +Display version information about the current instance of Bash. + +@item shell-expand-line (M-C-e) +Expand the line as the shell does. +This performs alias and history expansion as well as all of the shell +word expansions (@pxref{Shell Expansions}). + +@item history-expand-line (M-^) +Perform history expansion on the current line. + +@item magic-space () +Perform history expansion on the current line and insert a space +(@pxref{History Interaction}). + +@item alias-expand-line () +Perform alias expansion on the current line (@pxref{Aliases}). + +@item history-and-alias-expand-line () +Perform history and alias expansion on the current line. + +@item insert-last-argument (M-. or M-_) +A synonym for @code{yank-last-arg}. + +@item operate-and-get-next (C-o) +Accept the current line for execution and fetch the next line +relative to the current line from the history for editing. Any +argument is ignored. + +@item edit-and-execute-command (C-xC-e) +Invoke an editor on the current command line, and execute the result as shell +commands. +Bash attempts to invoke +@code{$VISUAL}, @code{$EDITOR}, and @code{emacs} +as the editor, in that order. + +@end ifset + +@ifclear BashFeatures +@item emacs-editing-mode (C-e) +When in @code{vi} command mode, this causes a switch to @code{emacs} +editing mode. + +@item vi-editing-mode (M-C-j) +When in @code{emacs} editing mode, this causes a switch to @code{vi} +editing mode. + +@end ifclear + +@end ftable + +@node Readline vi Mode +@section Readline vi Mode + +While the Readline library does not have a full set of @code{vi} +editing functions, it does contain enough to allow simple editing +of the line. The Readline @code{vi} mode behaves as specified in +the @sc{posix} 1003.2 standard. + +@ifset BashFeatures +In order to switch interactively between @code{emacs} and @code{vi} +editing modes, use the @samp{set -o emacs} and @samp{set -o vi} +commands (@pxref{The Set Builtin}). +@end ifset +@ifclear BashFeatures +In order to switch interactively between @code{emacs} and @code{vi} +editing modes, use the command @kbd{M-C-j} (bound to emacs-editing-mode +when in @code{vi} mode and to vi-editing-mode in @code{emacs} mode). +@end ifclear +The Readline default is @code{emacs} mode. + +When you enter a line in @code{vi} mode, you are already placed in +`insertion' mode, as if you had typed an @samp{i}. Pressing @key{ESC} +switches you into `command' mode, where you can edit the text of the +line with the standard @code{vi} movement keys, move to previous +history lines with @samp{k} and subsequent lines with @samp{j}, and +so forth. + +@ifset BashFeatures +@node Programmable Completion +@section Programmable Completion +@cindex programmable completion + +When word completion is attempted for an argument to a command for +which a completion specification (a @var{compspec}) has been defined +using the @code{complete} builtin (@pxref{Programmable Completion Builtins}), +the programmable completion facilities are invoked. + +First, the command name is identified. +If a compspec has been defined for that command, the +compspec is used to generate the list of possible completions for the word. +If the command word is a full pathname, a compspec for the full +pathname is searched for first. +If no compspec is found for the full pathname, an attempt is made to +find a compspec for the portion following the final slash. + +Once a compspec has been found, it is used to generate the list of +matching words. +If a compspec is not found, the default Bash completion +described above (@pxref{Commands For Completion}) is performed. + +First, the actions specified by the compspec are used. +Only matches which are prefixed by the word being completed are +returned. +When the @option{-f} or @option{-d} option is used for filename or +directory name completion, the shell variable @env{FIGNORE} is +used to filter the matches. +@xref{Bash Variables}, for a description of @env{FIGNORE}. + +Any completions specified by a filename expansion pattern to the +@option{-G} option are generated next. +The words generated by the pattern need not match the word being completed. +The @env{GLOBIGNORE} shell variable is not used to filter the matches, +but the @env{FIGNORE} shell variable is used. + +Next, the string specified as the argument to the @option{-W} option +is considered. +The string is first split using the characters in the @env{IFS} +special variable as delimiters. +Shell quoting is honored. +Each word is then expanded using +brace expansion, tilde expansion, parameter and variable expansion, +command substitution, and arithmetic expansion, +as described above (@pxref{Shell Expansions}). +The results are split using the rules described above +(@pxref{Word Splitting}). +The results of the expansion are prefix-matched against the word being +completed, and the matching words become the possible completions. + +After these matches have been generated, any shell function or command +specified with the @option{-F} and @option{-C} options is invoked. +When the command or function is invoked, the @env{COMP_LINE} and +@env{COMP_POINT} variables are assigned values as described above +(@pxref{Bash Variables}). +If a shell function is being invoked, the @env{COMP_WORDS} and +@env{COMP_CWORD} variables are also set. +When the function or command is invoked, the first argument is the +name of the command whose arguments are being completed, the +second argument is the word being completed, and the third argument +is the word preceding the word being completed on the current command line. +No filtering of the generated completions against the word being completed +is performed; the function or command has complete freedom in generating +the matches. + +Any function specified with @option{-F} is invoked first. +The function may use any of the shell facilities, including the +@code{compgen} builtin described below +(@pxref{Programmable Completion Builtins}), to generate the matches. +It must put the possible completions in the @env{COMPREPLY} array +variable. + +Next, any command specified with the @option{-C} option is invoked +in an environment equivalent to command substitution. +It should print a list of completions, one per line, to +the standard output. +Backslash may be used to escape a newline, if necessary. + +After all of the possible completions are generated, any filter +specified with the @option{-X} option is applied to the list. +The filter is a pattern as used for pathname expansion; a @samp{&} +in the pattern is replaced with the text of the word being completed. +A literal @samp{&} may be escaped with a backslash; the backslash +is removed before attempting a match. +Any completion that matches the pattern will be removed from the list. +A leading @samp{!} negates the pattern; in this case any completion +not matching the pattern will be removed. + +Finally, any prefix and suffix specified with the @option{-P} and @option{-S} +options are added to each member of the completion list, and the result is +returned to the Readline completion code as the list of possible +completions. + +If the previously-applied actions do not generate any matches, and the +@option{-o dirnames} option was supplied to @code{complete} when the +compspec was defined, directory name completion is attempted. + +If the @option{-o plusdirs} option was supplied to @code{complete} when +the compspec was defined, directory name completion is attempted and any +matches are added to the results of the other actions. + +By default, if a compspec is found, whatever it generates is returned to +the completion code as the full set of possible completions. +The default Bash completions are not attempted, and the Readline default +of filename completion is disabled. +If the @option{-o bashdefault} option was supplied to @code{complete} when +the compspec was defined, the default Bash completions are attempted +if the compspec generates no matches. +If the @option{-o default} option was supplied to @code{complete} when the +compspec was defined, Readline's default completion will be performed +if the compspec (and, if attempted, the default Bash completions) +generate no matches. + +When a compspec indicates that directory name completion is desired, +the programmable completion functions force Readline to append a slash +to completed names which are symbolic links to directories, subject to +the value of the @var{mark-directories} Readline variable, regardless +of the setting of the @var{mark-symlinked-directories} Readline variable. + +@node Programmable Completion Builtins +@section Programmable Completion Builtins +@cindex completion builtins + +Two builtin commands are available to manipulate the programmable completion +facilities. + +@table @code +@item compgen +@btindex compgen +@example +@code{compgen [@var{option}] [@var{word}]} +@end example + +Generate possible completion matches for @var{word} according to +the @var{option}s, which may be any option accepted by the +@code{complete} +builtin with the exception of @option{-p} and @option{-r}, and write +the matches to the standard output. +When using the @option{-F} or @option{-C} options, the various shell variables +set by the programmable completion facilities, while available, will not +have useful values. + +The matches will be generated in the same way as if the programmable +completion code had generated them directly from a completion specification +with the same flags. +If @var{word} is specified, only those completions matching @var{word} +will be displayed. + +The return value is true unless an invalid option is supplied, or no +matches were generated. + +@item complete +@btindex complete +@example +@code{complete [-abcdefgjksuv] [-o @var{comp-option}] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}] +[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}] +[-C @var{command}] @var{name} [@var{name} @dots{}]} +@code{complete -pr [@var{name} @dots{}]} +@end example + +Specify how arguments to each @var{name} should be completed. +If the @option{-p} option is supplied, or if no options are supplied, existing +completion specifications are printed in a way that allows them to be +reused as input. +The @option{-r} option removes a completion specification for +each @var{name}, or, if no @var{name}s are supplied, all +completion specifications. + +The process of applying these completion specifications when word completion +is attempted is described above (@pxref{Programmable Completion}). + +Other options, if specified, have the following meanings. +The arguments to the @option{-G}, @option{-W}, and @option{-X} options +(and, if necessary, the @option{-P} and @option{-S} options) +should be quoted to protect them from expansion before the +@code{complete} builtin is invoked. + + +@table @code +@item -o @var{comp-option} +The @var{comp-option} controls several aspects of the compspec's behavior +beyond the simple generation of completions. +@var{comp-option} may be one of: + +@table @code + +@item bashdefault +Perform the rest of the default Bash completions if the compspec +generates no matches. + +@item default +Use Readline's default filename completion if the compspec generates +no matches. + +@item dirnames +Perform directory name completion if the compspec generates no matches. + +@item filenames +Tell Readline that the compspec generates filenames, so it can perform any +filename-specific processing (like adding a slash to directory names or +suppressing trailing spaces). This option is intended to be used with +shell functions specified with @option{-F}. + +@item nospace +Tell Readline not to append a space (the default) to words completed at +the end of the line. + +@item plusdirs +After any matches defined by the compspec are generated, +directory name completion is attempted and any +matches are added to the results of the other actions. + +@end table + +@item -A @var{action} +The @var{action} may be one of the following to generate a list of possible +completions: + +@table @code +@item alias +Alias names. May also be specified as @option{-a}. + +@item arrayvar +Array variable names. + +@item binding +Readline key binding names (@pxref{Bindable Readline Commands}). + +@item builtin +Names of shell builtin commands. May also be specified as @option{-b}. + +@item command +Command names. May also be specified as @option{-c}. + +@item directory +Directory names. May also be specified as @option{-d}. + +@item disabled +Names of disabled shell builtins. + +@item enabled +Names of enabled shell builtins. + +@item export +Names of exported shell variables. May also be specified as @option{-e}. + +@item file +File names. May also be specified as @option{-f}. + +@item function +Names of shell functions. + +@item group +Group names. May also be specified as @option{-g}. + +@item helptopic +Help topics as accepted by the @code{help} builtin (@pxref{Bash Builtins}). + +@item hostname +Hostnames, as taken from the file specified by the +@env{HOSTFILE} shell variable (@pxref{Bash Variables}). + +@item job +Job names, if job control is active. May also be specified as @option{-j}. + +@item keyword +Shell reserved words. May also be specified as @option{-k}. + +@item running +Names of running jobs, if job control is active. + +@item service +Service names. May also be specified as @option{-s}. + +@item setopt +Valid arguments for the @option{-o} option to the @code{set} builtin +(@pxref{The Set Builtin}). + +@item shopt +Shell option names as accepted by the @code{shopt} builtin +(@pxref{Bash Builtins}). + +@item signal +Signal names. + +@item stopped +Names of stopped jobs, if job control is active. + +@item user +User names. May also be specified as @option{-u}. + +@item variable +Names of all shell variables. May also be specified as @option{-v}. +@end table + +@item -G @var{globpat} +The filename expansion pattern @var{globpat} is expanded to generate +the possible completions. + +@item -W @var{wordlist} +The @var{wordlist} is split using the characters in the +@env{IFS} special variable as delimiters, and each resultant word +is expanded. +The possible completions are the members of the resultant list which +match the word being completed. + +@item -C @var{command} +@var{command} is executed in a subshell environment, and its output is +used as the possible completions. + +@item -F @var{function} +The shell function @var{function} is executed in the current shell +environment. +When it finishes, the possible completions are retrieved from the value +of the @env{COMPREPLY} array variable. + +@item -X @var{filterpat} +@var{filterpat} is a pattern as used for filename expansion. +It is applied to the list of possible completions generated by the +preceding options and arguments, and each completion matching +@var{filterpat} is removed from the list. +A leading @samp{!} in @var{filterpat} negates the pattern; in this +case, any completion not matching @var{filterpat} is removed. + +@item -P @var{prefix} +@var{prefix} is added at the beginning of each possible completion +after all other options have been applied. + +@item -S @var{suffix} +@var{suffix} is appended to each possible completion +after all other options have been applied. +@end table + +The return value is true unless an invalid option is supplied, an option +other than @option{-p} or @option{-r} is supplied without a @var{name} +argument, an attempt is made to remove a completion specification for +a @var{name} for which no specification exists, or +an error occurs adding a completion specification. + +@end table +@end ifset diff --git a/readline/doc/rluserman.pdf b/readline/doc/rluserman.pdf new file mode 100644 index 0000000..4a2184b Binary files /dev/null and b/readline/doc/rluserman.pdf differ diff --git a/readline/doc/rluserman.texi b/readline/doc/rluserman.texi new file mode 100644 index 0000000..db80b31 --- /dev/null +++ b/readline/doc/rluserman.texi @@ -0,0 +1,88 @@ +\input texinfo @c -*-texinfo-*- +@comment %**start of header (This is for running Texinfo on a region.) +@setfilename rluserman.info +@settitle GNU Readline Library +@comment %**end of header (This is for running Texinfo on a region.) + +@setchapternewpage odd + +@include version.texi + +@copying +This manual describes the end user interface of the GNU Readline Library +(version @value{VERSION}, @value{UPDATED}), a library which aids in the +consistency of user interface across discrete programs which provide +a command line interface. + +Copyright @copyright{} 1988-2005 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license is +included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify +this GNU Manual, like GNU software. Copies published by the Free +Software Foundation raise funds for GNU development.'' +@end quotation +@end copying + +@dircategory Libraries +@direntry +* RLuserman: (rluserman). The GNU readline library User's Manual. +@end direntry + +@titlepage +@title GNU Readline Library User Interface +@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}. +@subtitle @value{UPDATED-MONTH} +@author Chet Ramey, Case Western Reserve University +@author Brian Fox, Free Software Foundation + +@page +@vskip 0pt plus 1filll +@insertcopying + +@sp 1 +Published by the Free Software Foundation @* +59 Temple Place, Suite 330, @* +Boston, MA 02111-1307 @* +USA @* + +@end titlepage + +@contents + +@ifnottex +@node Top +@top GNU Readline Library + +This document describes the end user interface of the GNU Readline Library, +a utility which aids in the consistency of user interface across discrete +programs which provide a command line interface. + +@menu +* Command Line Editing:: GNU Readline User's Manual. +* Copying This Manual:: Copying This Manual. +@end menu +@end ifnottex + +@include rluser.texi + +@node Copying This Manual +@appendix Copying This Manual + +@menu +* GNU Free Documentation License:: License for copying this manual. +@end menu + +@include fdl.texi + +@bye diff --git a/readline/doc/version.texi b/readline/doc/version.texi new file mode 100644 index 0000000..99816bf --- /dev/null +++ b/readline/doc/version.texi @@ -0,0 +1,10 @@ +@ignore +Copyright (C) 1988-2005 Free Software Foundation, Inc. +@end ignore + +@set EDITION 5.1-beta1 +@set VERSION 5.1-beta1 +@set UPDATED 11 November 2005 +@set UPDATED-MONTH November 2005 + +@set LASTCHANGE Fri Nov 11 19:50:51 EST 2005 diff --git a/readline/examples/rl-fgets.c b/readline/examples/rl-fgets.c new file mode 100644 index 0000000..5512b94 --- /dev/null +++ b/readline/examples/rl-fgets.c @@ -0,0 +1,374 @@ +/* +Date: Tue, 16 Mar 2004 19:38:40 -0800 +From: Harold Levy +Subject: fgets(stdin) --> readline() redirector +To: chet@po.cwru.edu + +Hi Chet, + +Here is something you may find useful enough to include in the readline +distribution. It is a shared library that redirects calls to fgets(stdin) +to readline() via LD_PRELOAD, and it supports a custom prompt and list of +command names. Many people have asked me for this file, so I thought I'd +pass it your way in hope of just including it with readline to begin with. + +Best Regards, + +-Harold +*/ + +/****************************************************************************** +******************************************************************************* + + FILE NAME: fgets.c TARGET: libfgets.so + AUTHOR: Harold Levy VERSION: 1.0 + hlevy@synopsys.com + + ABSTRACT: Customize fgets() behavior via LD_PRELOAD in the following ways: + + -- If fgets(stdin) is called, redirect to GNU readline() to obtain + command-line editing, file-name completion, history, etc. + + -- A list of commands for command-name completion can be configured by + setting the environment-variable FGETS_COMMAND_FILE to a file containing + the list of commands to be used. + + -- Command-line editing with readline() works best when the prompt string + is known; you can set this with the FGETS_PROMPT environment variable. + + -- There special strings that libfgets will interpret as internal commands: + + _fgets_reset_ reset the command list + + _fgets_dump_ dump status + + _fgets_debug_ toggle debug messages + + HOW TO BUILD: Here are examples of how to build libfgets.so on various + platforms; you will have to add -I and -L flags to configure access to + the readline header and library files. + + (32-bit builds with gcc) + AIX: gcc -fPIC fgets.c -shared -o libfgets.so -lc -ldl -lreadline -ltermcap + HP-UX: gcc -fPIC fgets.c -shared -o libfgets.so -lc -ldld -lreadline + Linux: gcc -fPIC fgets.c -shared -o libfgets.so -lc -ldl -lreadline + SunOS: gcc -fPIC fgets.c -shared -o libfgets.so -lc -ldl -lgen -lreadline + + (64-bit builds without gcc) + SunOS: SUNWspro/bin/cc -D_LARGEFILE64_SOURCE=1 -xtarget=ultra -xarch=v9 \ + -KPIC fgets.c -Bdynamic -lc -ldl -lgen -ltermcap -lreadline + + HOW TO USE: Different operating systems have different levels of support + for the LD_PRELOAD concept. The generic method for 32-bit platforms is to + put libtermcap.so, libfgets.so, and libreadline.so (with absolute paths) + in the LD_PRELOAD environment variable, and to put their parent directories + in the LD_LIBRARY_PATH environment variable. Unfortunately there is no + generic method for 64-bit platforms; e.g. for 64-bit SunOS, you would have + to build both 32-bit and 64-bit libfgets and libreadline libraries, and + use the LD_FLAGS_32 and LD_FLAGS_64 environment variables with preload and + library_path configurations (a mix of 32-bit and 64-bit calls are made under + 64-bit SunOS). + + EXAMPLE WRAPPER: Here is an example shell script wrapper around the + program "foo" that uses fgets() for command-line input: + + #!/bin/csh + #### replace this with the libtermcap.so directory: + set dir1 = "/usr/lib" + #### replace this with the libfgets.so directory: + set dir2 = "/usr/fgets" + #### replace this with the libreadline.so directory: + set dir3 = "/usr/local/lib" + set lib1 = "${dir1}/libtermcap.so" + set lib2 = "${dir2}/libfgets.so" + set lib3 = "${dir3}/libreadline.so" + if ( "${?LD_PRELOAD}" ) then + setenv LD_PRELOAD "${lib1}:${lib2}:${lib3}:${LD_PRELOAD}" + else + setenv LD_PRELOAD "${lib1}:${lib2}:${lib3}" + endif + if ( "${?LD_LIBRARY_PATH}" ) then + setenv LD_LIBRARY_PATH "${dir1}:${dir2}:${dir3}:${LD_LIBRARY_PATH}" + else + setenv LD_LIBRARY_PATH "${dir1}:${dir2}:${dir3}" + endif + setenv FGETS_COMMAND_FILE "${dir2}/foo.commands" + setenv FGETS_PROMPT "foo> " + exec "foo" $* + + Copyright (C)©2003-2004 Harold Levy. + + This code links to the GNU readline library, and as such is bound by the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 2 or (at your option) any later version. + + The GNU General Public License is often shipped with GNU software, and is + generally kept in a file called COPYING or LICENSE. If you do not have a + copy of the license, write to the Free Software Foundation, 59 Temple Place, + Suite 330, Boston, MA 02111 USA. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + +******************************************************************************* +******************************************************************************/ + + + +#include +#include +#include +#include +#include + +#include +#include + + + +/* for dynamically connecting to the native fgets() */ +#if defined(RTLD_NEXT) +#define REAL_LIBC RTLD_NEXT +#else +#define REAL_LIBC ((void *) -1L) +#endif +typedef char * ( * fgets_t ) ( char * s, int n, FILE * stream ) ; + + + +/* private data */ +/* -- writeable data is stored in the shared library's data segment + -- every process that uses the shared library gets a private memory copy of + its entire data segment + -- static data in the shared library is not copied to the application + -- only read-only (i.e. 'const') data is stored in the shared library's + text segment +*/ +static char ** my_fgets_names = NULL ; +static int my_fgets_number_of_names = 0 ; +static int my_fgets_debug_flag = 0 ; + + + +/* invoked with _fgets_reset_ */ +static void +my_fgets_reset ( + void +) { + if ( my_fgets_names && (my_fgets_number_of_names > 0) ) { + int i ; + if ( my_fgets_debug_flag ) { + printf ( "libfgets: removing command list\n" ) ; + } + for ( i = 0 ; i < my_fgets_number_of_names ; i ++ ) { + if ( my_fgets_names[i] ) free ( my_fgets_names[i] ) ; + } + free ( my_fgets_names ) ; + } + my_fgets_names = NULL ; + my_fgets_number_of_names = 0 ; +} + + + +/* invoked with _fgets_dump_ */ +static void +my_fgets_dump ( + void +) { + char * s ; + printf ( "\n" ) ; + s = getenv ( "FGETS_PROMPT" ) ; + printf ( "FGETS_PROMPT = %s\n", s ? s : "" ) ; + s = getenv ( "FGETS_COMMAND_FILE" ) ; + printf ( "FGETS_COMMAND_FILE = %s\n", s ? s : "" ) ; + printf ( "debug flag = %d\n", my_fgets_debug_flag ) ; + printf ( "#commands = %d\n", my_fgets_number_of_names ) ; + if ( my_fgets_debug_flag ) { + if ( my_fgets_names && (my_fgets_number_of_names > 0) ) { + int i ; + for ( i = 0 ; i < my_fgets_number_of_names ; i ++ ) { + printf ( "%s\n", my_fgets_names[i] ) ; + } + } + } + printf ( "\n" ) ; +} + + + +/* invoked with _fgets_debug_ */ +static void +my_fgets_debug_toggle ( + void +) { + my_fgets_debug_flag = my_fgets_debug_flag ? 0 : 1 ; + if ( my_fgets_debug_flag ) { + printf ( "libfgets: debug flag = %d\n", my_fgets_debug_flag ) ; + } +} + + + +/* read the command list if needed, return the i-th name */ +static char * +my_fgets_lookup ( + int index +) { + if ( (! my_fgets_names) || (! my_fgets_number_of_names) ) { + char * fname ; + FILE * fp ; + fgets_t _fgets ; + int i ; + char buf1[256], buf2[256] ; + fname = getenv ( "FGETS_COMMAND_FILE" ) ; + if ( ! fname ) { + if ( my_fgets_debug_flag ) { + printf ( "libfgets: empty or unset FGETS_COMMAND_FILE\n" ) ; + } + return NULL ; + } + fp = fopen ( fname, "r" ) ; + if ( ! fp ) { + if ( my_fgets_debug_flag ) { + printf ( "libfgets: cannot open '%s' for reading\n", fname ) ; + } + return NULL ; + } + _fgets = (fgets_t) dlsym ( REAL_LIBC, "fgets" ) ; + if ( ! _fgets ) { + fprintf ( stderr, + "libfgets: failed to dynamically link to native fgets()\n" + ) ; + return NULL ; + } + for ( i = 0 ; _fgets(buf1,255,fp) ; i ++ ) ; + if ( ! i ) { fclose(fp) ; return NULL ; } + my_fgets_names = (char**) calloc ( i, sizeof(char*) ) ; + rewind ( fp ) ; + i = 0 ; + while ( _fgets(buf1,255,fp) ) { + buf1[255] = 0 ; + if ( 1 == sscanf(buf1,"%s",buf2) ) { + my_fgets_names[i] = strdup(buf2) ; + i ++ ; + } + } + fclose ( fp ) ; + my_fgets_number_of_names = i ; + if ( my_fgets_debug_flag ) { + printf ( "libfgets: successfully read %d commands\n", i ) ; + } + } + if ( index < my_fgets_number_of_names ) { + return my_fgets_names[index] ; + } else { + return NULL ; + } +} + + + +/* generate a list of partial name matches for readline() */ +static char * +my_fgets_generator ( + const char * text, + int state +) +{ + static int list_index, len ; + char * name ; + if ( ! state ) { + list_index = 0 ; + len = strlen ( text ) ; + } + while ( ( name = my_fgets_lookup(list_index) ) ) { + list_index ++ ; + if ( ! strncmp ( name, text, len ) ) { + return ( strdup ( name ) ) ; + } + } + return ( NULL ) ; +} + + + +/* partial name completion callback for readline() */ +static char ** +my_fgets_completion ( + const char * text, + int start, + int end +) +{ + char ** matches ; + matches = NULL ; + if ( ! start ) { + matches = rl_completion_matches ( text, my_fgets_generator ) ; + } + return ( matches ) ; +} + + + +/* fgets() intercept */ +char * +fgets ( + char * s, + int n, + FILE * stream +) +{ + if ( ! s ) return NULL ; + if ( stream == stdin ) { + char * prompt ; + char * my_fgets_line ; + rl_already_prompted = 1 ; + rl_attempted_completion_function = my_fgets_completion ; + rl_catch_signals = 1 ; + rl_catch_sigwinch = 1 ; + rl_set_signals () ; + prompt = getenv ( "FGETS_PROMPT" ) ; + for ( + my_fgets_line = 0 ; ! my_fgets_line ; my_fgets_line=readline(prompt) + ) ; + if ( ! strncmp(my_fgets_line, "_fgets_reset_", 13) ) { + my_fgets_reset () ; + free ( my_fgets_line ) ; + strcpy ( s, "\n" ) ; + return ( s ) ; + } + if ( ! strncmp(my_fgets_line, "_fgets_dump_", 12) ) { + my_fgets_dump () ; + free ( my_fgets_line ) ; + strcpy ( s, "\n" ) ; + return ( s ) ; + } + if ( ! strncmp(my_fgets_line, "_fgets_debug_", 13) ) { + my_fgets_debug_toggle () ; + free ( my_fgets_line ) ; + strcpy ( s, "\n" ) ; + return ( s ) ; + } + (void) strncpy ( s, my_fgets_line, n-1 ) ; + (void) strcat ( s, "\n" ) ; + if ( *my_fgets_line ) add_history ( my_fgets_line ) ; + free ( my_fgets_line ) ; + return ( s ) ; + } else { + static fgets_t _fgets ; + _fgets = (fgets_t) dlsym ( REAL_LIBC, "fgets" ) ; + if ( ! _fgets ) { + fprintf ( stderr, + "libfgets: failed to dynamically link to native fgets()\n" + ) ; + strcpy ( s, "\n" ) ; + return ( s ) ; + } + return ( + _fgets ( s, n, stream ) + ) ; + } +} diff --git a/readline/examples/rlfe/ChangeLog b/readline/examples/rlfe/ChangeLog new file mode 100644 index 0000000..ba41b2b --- /dev/null +++ b/readline/examples/rlfe/ChangeLog @@ -0,0 +1,37 @@ +2004-11-04 Per Bothner + + * pty.c: Import from screen-4.0.2. + * configure.in, Makefile.in, config.h.in: Set up autoconf handling, + copying a bunk of stuff over from screen. + * rlfe.c: Use OpenPTY from pty.c instead of get_master_pty. + +2004-11-03 Per Bothner + + * rlfe.c: Get input emphasis (boldening) more robust. + + * rlfe.c: Various cleanups on comments and names. + +2003-11-07 Wolfgang Taeuber + + * Specify a history file and the size of the history file with command + * line options; use EDITOR/VISUAL to set vi/emacs preference. + +1999-09-03 Chet Ramey + + * fep.c: Memmove is not universally available. This patch assumes + that an autoconf test has been performed, and that memcpy is + available without checking. + + * fep.c: VDISCARD is not universally available, even when termios is. + + * fep.c: If a system doesn't have TIOCSCTTY, the first `open' + performed after setsid allocates a controlling terminal. The + original code would leave the child process running on the slave pty + without a controlling tty if TIOCSCTTY was not available. + + * fep.c: Most versions of SVR4, including solaris, don't allow + terminal ioctl calls on the master side of the pty. + +1999-08-28 Per Bothner + + * fep.c: Initial release. diff --git a/readline/examples/rlfe/Makefile.in b/readline/examples/rlfe/Makefile.in new file mode 100644 index 0000000..4653dec --- /dev/null +++ b/readline/examples/rlfe/Makefile.in @@ -0,0 +1,176 @@ +# +# Makefile template for rlfe +# +# See machine dependant config.h for more configuration options. +# + +srcdir = @srcdir@ +VPATH = @srcdir@ + +DESTDIR = + +# Where to install screen. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# don't forget to change mandir and infodir in doc/Makefile. +bindir = $(exec_prefix)/bin + +VERSION = @VERSION@ +SCREEN = screen-$(VERSION) + +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +#LDFLAGS = -L$(READLINE_DIR) +LDFLAGS = @LDFLAGS@ +LIBS = -lreadline -lhistory -lncurses + +CPP=@CPP@ +CPP_DEPEND=$(CC) -MM + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +AWK = @AWK@ + +OPTIONS= +#OPTIONS= -DDEBUG + +SHELL=/bin/sh + +CFILES= rlfe.c pty.c +HFILES= extern.h os.h screen.h +EXTRA_DIST=configure.in configure Makefile.in config.h.in ChangeLog README +OFILES= rlfe.o pty.o + +all: rlfe + +rlfe: $(OFILES) + $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) + +rlfe-$(VERSION).tar.gz: + tar czf $@ $(CFILES) $(HFILES) $(EXTRA_DIST) + +.c.o: + $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< + +install_bin: .version screen + -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \ + then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi + $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN) + -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN) +# This doesn't work if $(bindir)/screen is a symlink + -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi + rm -f $(DESTDIR)$(bindir)/screen + (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen) + cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) + + +uninstall: .version + rm -f $(DESTDIR)$(bindir)/$(SCREEN) + rm -f $(DESTDIR)$(bindir)/screen + -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen + rm -f $(DESTDIR)$(ETCSCREENRC) + cd doc; $(MAKE) uninstall + +shadow: + mkdir shadow; + cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc . + rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h + echo "install all Makefiles and config:" > shadow/Makefile + echo " rm -f config.cache" >> shadow/Makefile + echo " sh ./configure" >> shadow/Makefile + +term.h: term.c term.sh + AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh + +kmapdef.c: term.h + +tty.c: tty.sh + sh $(srcdir)/tty.sh tty.c + +mostlyclean: + rm -f $(OFILES) rlfe *.o + +clean celan: mostlyclean + rm -f tty.c term.h comm.h osdef.h kmapdef.c core + +# Delete all files from the current directory that are created by +# configuring or building the program. +# building of term.h/comm.h requires awk. Keep it in the distribution +# we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC. +#distclean: mostlyclean +# rm -f $(SCREEN).tar $(SCREEN).tar.gz +# rm -f config.status Makefile +# rm -f osdef.h doc/Makefile + +maintainer-clean: + @echo "This command is not even intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + + +# Delete everything from the current directory that can be +# reconstructed with this Makefile. +realclean: .version mostlyclean + rm -f $(SCREEN).tar $(SCREEN).tar.gz + rm -f config.status Makefile doc/Makefile + rm -f tty.c term.h comm.h osdef.h kmapdef.c + rm -f config.h + echo "install all Makefiles and config:" > Makefile + echo " sh ./configure" >> Makefile + +tags TAGS: $(CFILES) + -ctags *.sh $(CFILES) *.h + -ctags -e *.sh $(CFILES) *.h + +dist: .version $(SCREEN).tar.gz + + +# Perform self-tests (if any). +check: + +config: + rm -f config.cache + sh ./configure + + +############################################################################### + +.version: + @rev=`sed < $(srcdir)/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \ + vers=`sed < $(srcdir)/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \ + pat=`sed < $(srcdir)/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \ + if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \ + echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \ + echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi + +############################################################################### + +mdepend: $(CFILES) term.h + @rm -f DEPEND ; \ + for i in ${CFILES} ; do \ + echo "$$i" ; \ + echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\ + cc -E $$i |\ + grep '^# .*"\./.*\.h"' |\ + (sort -t'"' -u -k 2,2 2>/dev/null || sort -t'"' -u +1 -2) |\ + sed -e 's/.*"\.\/\(.*\)".*/\1/'\ + ` >> DEPEND ; \ + done + +depend: depend.in + ./config.status || ./configure + +depend.in: $(CFILES) term.h + cp Makefile.in Makefile.in~ + sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make + for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done + mv tmp_make Makefile.in + +############################################################################### + +### Dependencies: +pty.o: pty.c config.h diff --git a/readline/examples/rlfe/README b/readline/examples/rlfe/README new file mode 100644 index 0000000..9e1f689 --- /dev/null +++ b/readline/examples/rlfe/README @@ -0,0 +1,78 @@ +rlfe (ReadLine Front-End) is a "universal wrapper" around readline. +You specify an interactive program to run (typically a shell), and +readline is used to edit input lines. + +There are other such front-ends; what distinguishes this one is that +it monitors the state of the inferior pty, and if the inferior program +switches its terminal to raw mode, then rlfe passes your characters +through directly. This basically means you can run your entire +session (including bash and terminal-mode emacs) under rlfe. + +FEATURES + +* Can use all readline commands (and history) in commands that +read input lines in "canonical mode" - even 'cat'! + +* Automatically switches between "readline-editing mode" and "raw mode" +depending on the terminal mode. If the inferior program invokes +readline itself, it will do its own line editing. (The inferior +readline will not know about rlfe, and it will have its own history.) +You can even run programs like 'emavs -nw' and 'vi' under rlfe. +The goal is you could leave rlfe always on without even knowing +about it. (We're not quite there, but it works tolerably well.) + +* The input line (after any prompt) is changed to bold-face. + +INSTALL + +The usual: ./configure && make && make install + +Note so far rlfe has only been tested on GNU Linux (Fedora Core 2) +and Mac OS X (10.3). + +This assumes readline header files and libraries are in the default +places. If not, you can create a link named readline pointing to the +readline sources. To link with libreadline.a and libhistory.a +you can copy or link them, or add LDFLAGS='-/path/to/readline' to +the make command-line. + +USAGE + +Just run it. That by default runs bash. You can run some other +command by giving it as command-line arguments. + +There are a few tweaks: -h allows you to name the history file, +and -s allows you to specify its size. It default to "emacs" mode, +but if the the environment variable EDITOR is set to "vi" that +mode is chosen. + +ISSUES + +* The mode switching depends on the terminal mode set by the inferior +program. Thus ssh/telnet/screen-type programs will typically be in +raw mode, so rlfe won't be much use, even if remote programs run in +canonical mode. The work-around is to run rlfe on the remote end. + +* Echo supression and prompt recognition are somewhat fragile. +(A protocol so that the o/s tty code can reliably communicate its +state to rlfe could solve this problem, and the previous one.) + +* See the intro to rlfe.c for more notes. + +* Assumes a VT100-compatible terminal, though that could be generalized +if anybody cares. + +* Requires ncurses. + +* It would be useful to integrate rlfe's logic in a terminal emulator. +That would make it easier to reposition the edit position with a mouse, +integrate cut-and-paste with the system clipboard, and more robustly +handle escape sequence and multi-byte characters more robustly. + +AUTHOR + +Per Bothner + +LICENSE + +GPL. diff --git a/readline/examples/rlfe/config.h.in b/readline/examples/rlfe/config.h.in new file mode 100644 index 0000000..f8ff13b --- /dev/null +++ b/readline/examples/rlfe/config.h.in @@ -0,0 +1,375 @@ +/* Copyright 2004 Per Bothner + * Based on config.h from screen-4.0.2. + * Copyright (c) 1993-2000 + * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) + * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) + * Copyright (c) 1987 Oliver Laumann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + * $Id$ FAU + */ + + + + + +/********************************************************************** + * + * User Configuration Section + */ + + +/* + * define PTYMODE if you do not like the default of 0622, which allows + * public write to your pty. + * define PTYGROUP to some numerical group-id if you do not want the + * tty to be in "your" group. + * Note, screen is unable to change mode or group of the pty if it + * is not installed with sufficient privilege. (e.g. set-uid-root) + * define PTYROFS if the /dev/pty devices are mounted on a read-only + * filesystem so screen should not even attempt to set mode or group + * even if running as root (e.g. on TiVo). + */ +#undef PTYMODE +#undef PTYGROUP +#undef PTYROFS + +/* + * If screen is NOT installed set-uid root, screen can provide tty + * security by exclusively locking the ptys. While this keeps other + * users from opening your ptys, it also keeps your own subprocesses + * from being able to open /dev/tty. Define LOCKPTY to add this + * exclusive locking. + */ +#undef LOCKPTY + + +/********************************************************************** + * + * End of User Configuration Section + * + * Rest of this file is modified by 'configure' + * Change at your own risk! + * + */ + +/* + * Some defines to identify special unix variants + */ +#ifndef SVR4 +#undef SVR4 +#endif + +#ifndef _POSIX_SOURCE +#undef _POSIX_SOURCE +#endif + +/* + * Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX). + */ +#undef POSIX + +/* + * Define TERMIO if you have struct termio instead of struct sgttyb. + * This is usually the case for SVID systems, where BSD uses sgttyb. + * POSIX systems should define this anyway, even though they use + * struct termios. + */ +#undef TERMIO + +/* + * Define CYTERMIO if you have cyrillic termio modes. + */ +#undef CYTERMIO + +/* + * Define TERMINFO if your machine emulates the termcap routines + * with the terminfo database. + * Thus the .screenrc file is parsed for + * the command 'terminfo' and not 'termcap'. + */ +#undef TERMINFO + +/* + * If your library does not define ospeed, define this. + */ +#undef NEED_OSPEED + +/* + * Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX) + */ +#ifndef SYSV +#undef SYSV +#endif + +/* + * Define SIGVOID if your signal handlers return void. On older + * systems, signal returns int, but on newer ones, it returns void. + */ +#undef SIGVOID + +/* + * Define USESIGSET if you have sigset for BSD 4.1 reliable signals. + */ +#undef USESIGSET + +/* + * Define SYSVSIGS if signal handlers must be reinstalled after + * they have been called. + */ +#undef SYSVSIGS + +/* + * Define BSDWAIT if your system defines a 'union wait' in + * + * Only allow BSDWAIT i.e. wait3 on nonposix systems, since + * posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl + * + */ +#ifndef POSIX +#undef BSDWAIT +#endif + +/* + * On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com + */ +#ifdef BSDWAIT +#undef USE_WAIT2 +#endif + +/* + * Define if you have the utempter utmp helper program + */ +#undef HAVE_UTEMPTER + +/* + * If ttyslot() breaks getlogin() by returning indexes to utmp entries + * of type DEAD_PROCESS, then our getlogin() replacement should be + * selected by defining BUGGYGETLOGIN. + */ +#undef BUGGYGETLOGIN + +/* + * If your system has the calls setreuid() and setregid(), + * define HAVE_SETREUID. Otherwise screen will use a forked process to + * safely create output files without retaining any special privileges. + */ +#undef HAVE_SETREUID + +/* + * If your system supports BSD4.4's seteuid() and setegid(), define + * HAVE_SETEUID. + */ +#undef HAVE_SETEUID + +/* + * If you want the "time" command to display the current load average + * define LOADAV. Maybe you must install screen with the needed + * privileges to read /dev/kmem. + * Note that NLIST_ stuff is only checked, when getloadavg() is not available. + */ +#undef LOADAV + +#undef LOADAV_NUM +#undef LOADAV_TYPE +#undef LOADAV_SCALE +#undef LOADAV_GETLOADAVG +#undef LOADAV_UNIX +#undef LOADAV_AVENRUN +#undef LOADAV_USE_NLIST64 + +#undef NLIST_DECLARED +#undef NLIST_STRUCT +#undef NLIST_NAME_UNION + +/* + * If your system has the new format /etc/ttys (like 4.3 BSD) and the + * getttyent(3) library functions, define GETTTYENT. + */ +#undef GETTTYENT + +/* + * Define USEBCOPY if the bcopy/memcpy from your system's C library + * supports the overlapping of source and destination blocks. When + * undefined, screen uses its own (probably slower) version of bcopy(). + * + * SYSV machines may have a working memcpy() -- Oh, this is + * quite unlikely. Tell me if you see one. + * "But then, memmove() should work, if at all available" he thought... + * Boing, never say "works everywhere" unless you checked SCO UNIX. + * Their memove fails the test in the configure script. Sigh. (Juergen) + */ +#undef USEBCOPY +#undef USEMEMCPY +#undef USEMEMMOVE + +/* + * If your system has vsprintf() and requires the use of the macros in + * "varargs.h" to use functions with variable arguments, + * define USEVARARGS. + */ +#undef USEVARARGS + +/* + * If your system has strerror() define this. + */ +#undef HAVE_STRERROR + +/* + * If the select return value doesn't treat a descriptor that is + * usable for reading and writing as two hits, define SELECT_BROKEN. + */ +#undef SELECT_BROKEN + +/* + * Define this if your system supports named pipes. + */ +#undef NAMEDPIPE + +/* + * Define this if your system exits select() immediatly if a pipe is + * opened read-only and no writer has opened it. + */ +#undef BROKEN_PIPE + +/* + * Define this if the unix-domain socket implementation doesn't + * create a socket in the filesystem. + */ +#undef SOCK_NOT_IN_FS + +/* + * If your system has setenv() and unsetenv() define USESETENV + */ +#undef USESETENV + +/* + * If your system does not come with a setenv()/putenv()/getenv() + * functions, you may bring in our own code by defining NEEDPUTENV. + */ +#undef NEEDPUTENV + +/* + * If the passwords are stored in a shadow file and you want the + * builtin lock to work properly, define SHADOWPW. + */ +#undef SHADOWPW + +/* + * If you are on a SYS V machine that restricts filename length to 14 + * characters, you may need to enforce that by setting NAME_MAX to 14 + */ +#undef NAME_MAX /* KEEP_UNDEF_HERE override system value */ +#undef NAME_MAX + +/* + * define HAVE_RENAME if your system has a rename() function + */ +#undef HAVE_RENAME + +/* + * define HAVE__EXIT if your system has the _exit() call. + */ +#undef HAVE__EXIT + +/* + * define HAVE_LSTAT if your system has symlinks and the lstat() call. + */ +#undef HAVE_LSTAT + +/* + * define HAVE_UTIMES if your system has the utimes() call. + */ +#undef HAVE_UTIMES + +/* + * define HAVE_FCHOWN if your system has the fchown() call. + */ +#undef HAVE_FCHOWN + +/* + * define HAVE_FCHMOD if your system has the fchmod() call. + */ +#undef HAVE_FCHMOD + +/* + * define HAVE_VSNPRINTF if your system has vsnprintf() (GNU lib). + */ +#undef HAVE_VSNPRINTF + +/* + * define HAVE_GETCWD if your system has the getcwd() call. + */ +#undef HAVE_GETCWD + +/* + * define HAVE_SETLOCALE if your system has the setlocale() call. + */ +#undef HAVE_SETLOCALE + +/* + * define HAVE_STRFTIME if your system has the strftime() call. + */ +#undef HAVE_STRFTIME + +/* + * define HAVE_NL_LANGINFO if your system has the nl_langinfo() call + * and defines CODESET. + */ +#undef HAVE_NL_LANGINFO + +/* + * Newer versions of Solaris include fdwalk, which can greatly improve + * the startup time of screen; otherwise screen spends a lot of time + * closing file descriptors. + */ +#undef HAVE_FDWALK + +/* + * define HAVE_DEV_PTC if you have a /dev/ptc character special + * device. + */ +#undef HAVE_DEV_PTC + +/* + * define HAVE_SVR4_PTYS if you have a /dev/ptmx character special + * device and support the ptsname(), grantpt(), unlockpt() functions. + */ +#undef HAVE_SVR4_PTYS + +/* + * define HAVE_GETPT if you have the getpt() function. + */ +#undef HAVE_GETPT + +/* + * define HAVE_OPENPTY if your system has the openpty() call. + */ +#undef HAVE_OPENPTY + +/* + * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen + * to unusual environments. E.g. For SunOs the defaults are "qpr" and + * "0123456789abcdef". For SunOs 4.1.2 + * #define PTYRANGE0 "pqrstuvwxyzPQRST" + * is recommended by Dan Jacobson. + */ +#undef PTYRANGE0 +#undef PTYRANGE1 + +#define USEVARARGS diff --git a/readline/examples/rlfe/configure b/readline/examples/rlfe/configure new file mode 100755 index 0000000..ba82026 --- /dev/null +++ b/readline/examples/rlfe/configure @@ -0,0 +1,5400 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="rlfe.c" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AWK WRITEPATH XTERMPATH LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -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 \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -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=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pty-mode=mode default mode for ptys + --with-pty-group=group default group for ptys + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + ac_config_headers="$ac_config_headers config.h" + +VERSION=0.4 + + + +old_CFLAGS="$CFLAGS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + +fi + + +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +main(){exit(0);} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) + +if test $CC != cc ; then +echo "Your $CC failed - restarting with CC=cc" 1>&6 + +echo "" 1>&6 + +CC=cc +export CC +exec $0 $configure_args +fi + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +main(){exit(0);} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +exec 5>&2 +eval $ac_link +echo "CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;" 1>&6 + +echo "$ac_compile" 1>&6 + +{ { echo "$as_me:$LINENO: error: Can't run the compiler - sorry" >&5 +echo "$as_me: error: Can't run the compiler - sorry" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +main() +{ + int __something_strange_(); + __something_strange_(0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + { { echo "$as_me:$LINENO: error: Your compiler does not set the exit status - sorry" >&5 +echo "$as_me: error: Your compiler does not set the exit status - sorry" >&2;} + { (exit 1); exit 1; }; } +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + + +if test -f etc/toolcheck; then +{ echo "$as_me:$LINENO: checking for buggy tools..." >&5 +echo "$as_me: checking for buggy tools..." >&6;} +sh etc/toolcheck 1>&6 +fi + + +{ echo "$as_me:$LINENO: checking for System V..." >&5 +echo "$as_me: checking for System V..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +int +main () +{ +int x = SIGCHLD | FNDELAY; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >>confdefs.h <<\_ACEOF +#define SYSV 1 +_ACEOF + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for Solaris 2.x..." >&5 +echo "$as_me: checking for Solaris 2.x..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if defined(SVR4) && defined(sun) + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + LIBS="$LIBS -lsocket -lnsl -lkstat" +fi +rm -f conftest* + + + +{ echo "$as_me:$LINENO: checking select..." >&5 +echo "$as_me: checking select..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +select(0, 0, 0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS="$LIBS -lnet -lnsl" +{ echo "$as_me:$LINENO: checking select with $LIBS..." >&5 +echo "$as_me: checking select with $LIBS..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +select(0, 0, 0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: !!! no select - no screen" >&5 +echo "$as_me: error: !!! no select - no screen" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking select return value..." >&5 +echo "$as_me: checking select return value..." >&6;} +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include + +char *nam = "/tmp/conftest$$"; + +#ifdef NAMEDPIPE + +#ifndef O_NONBLOCK +#define O_NONBLOCK O_NDELAY +#endif +#ifndef S_IFIFO +#define S_IFIFO 0010000 +#endif + + +main() +{ +#ifdef FD_SET + fd_set f; +#else + int f; +#endif + +#ifdef __FreeBSD__ +/* From Andrew A. Chernov (ache@astral.msk.su): + * opening RDWR fifo fails in BSD 4.4, but select return values are + * right. + */ + exit(0); +#endif + (void)alarm(5); +#ifdef POSIX + if (mkfifo(nam, 0777)) +#else + if (mknod(nam, S_IFIFO|0777, 0)) +#endif + exit(1); + close(0); + if (open(nam, O_RDWR | O_NONBLOCK)) + exit(1); + if (write(0, "TEST", 4) == -1) + exit(1); + +#else + +#include +#include +#include + +main() +{ + int s1, s2, l; + struct sockaddr_un a; +#ifdef FD_SET + fd_set f; +#else + int f; +#endif + + (void)alarm(5); + if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + exit(1); + a.sun_family = AF_UNIX; + strcpy(a.sun_path, nam); + (void) unlink(nam); + if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1) + exit(1); + if (listen(s1, 2)) + exit(1); + if (fork() == 0) + { + if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + kill(getppid(), 3); + (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2); + if (write(s2, "HELLO", 5) == -1) + kill(getppid(), 3); + exit(0); + } + l = sizeof(a); + close(0); + if (accept(s1, (struct sockaddr *)&a, &l)) + exit(1); +#endif + + +#ifdef FD_SET + FD_SET(0, &f); +#else + f = 1; +#endif + if (select(1, &f, 0, 0, 0) == -1) + exit(1); + if (select(1, &f, &f, 0, 0) != 2) + exit(1); + exit(0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "- select is ok" 1>&6 + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +echo "- select can't count" 1>&6 + cat >>confdefs.h <<\_ACEOF +#define SELECT_BROKEN 1 +_ACEOF + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +{ echo "$as_me:$LINENO: checking for tgetent..." >&5 +echo "$as_me: checking for tgetent..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +tgetent((char *)0, (char *)0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +olibs="$LIBS" +LIBS="-lcurses $olibs" +{ echo "$as_me:$LINENO: checking libcurses..." >&5 +echo "$as_me: checking libcurses..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + +#ifdef __hpux +__sorry_hpux_libcurses_is_totally_broken_in_10_10(); +#else +tgetent((char *)0, (char *)0); +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS="-ltermcap $olibs" +{ echo "$as_me:$LINENO: checking libtermcap..." >&5 +echo "$as_me: checking libtermcap..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +tgetent((char *)0, (char *)0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS="-ltermlib $olibs" +{ echo "$as_me:$LINENO: checking libtermlib..." >&5 +echo "$as_me: checking libtermlib..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +tgetent((char *)0, (char *)0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS="-lncurses $olibs" +{ echo "$as_me:$LINENO: checking libncurses..." >&5 +echo "$as_me: checking libncurses..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +tgetent((char *)0, (char *)0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: !!! no tgetent - no screen" >&5 +echo "$as_me: error: !!! no tgetent - no screen" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +main() +{ + exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "- you use the termcap database" 1>&6 + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +echo "- you use the terminfo database" 1>&6 + cat >>confdefs.h <<\_ACEOF +#define TERMINFO 1 +_ACEOF + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: checking ospeed..." >&5 +echo "$as_me: checking ospeed..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +extern short ospeed; +int +main () +{ +ospeed=5; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >>confdefs.h <<\_ACEOF +#define NEED_OSPEED 1 +_ACEOF + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for /dev/ptc..." >&5 +echo "$as_me: checking for /dev/ptc..." >&6;} +if test -r /dev/ptc; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_DEV_PTC 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for SVR4 ptys..." >&5 +echo "$as_me: checking for SVR4 ptys..." >&6;} +sysvr4ptys= +if test -c /dev/ptmx ; then +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +ptsname(0);grantpt(0);unlockpt(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_SVR4_PTYS 1 +_ACEOF + +sysvr4ptys=1 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + +for ac_func in getpt +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +if test -z "$sysvr4ptys"; then + +for ac_func in openpty +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 +echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6 +if test "${ac_cv_lib_util_openpty+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char openpty (); +int +main () +{ +openpty (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_util_openpty=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_util_openpty=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6 +if test $ac_cv_lib_util_openpty = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_OPENPTY 1 +_ACEOF + LIBS="$LIBS -lutil" +fi + +fi +done + +fi + +{ echo "$as_me:$LINENO: checking for ptyranges..." >&5 +echo "$as_me: checking for ptyranges..." >&6;} +if test -d /dev/ptym ; then +pdir='/dev/ptym' +else +pdir='/dev' +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef M_UNIX + yes; +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + ptys=`echo /dev/ptyp??` +else + ptys=`echo $pdir/pty??` +fi +rm -f conftest* + +if test "$ptys" != "$pdir/pty??" ; then +p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` +p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` +cat >>confdefs.h <<_ACEOF +#define PTYRANGE0 "$p0" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PTYRANGE1 "$p1" +_ACEOF + +fi + + +# Check whether --with-pty-mode or --without-pty-mode was given. +if test "${with_pty_mode+set}" = set; then + withval="$with_pty_mode" + ptymode="${withval}" +fi; + +# Check whether --with-pty-group or --without-pty-group was given. +if test "${with_pty_group+set}" = set; then + withval="$with_pty_group" + ptygrp="${withval}" +fi; +test -n "$ptymode" || ptymode=0620 +if test -n "$ptygrp" ; then +cat >>confdefs.h <<_ACEOF +#define PTYMODE $ptymode +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PTYGROUP $ptygrp +_ACEOF + +else + +{ echo "$as_me:$LINENO: checking default tty permissions/group..." >&5 +echo "$as_me: checking default tty permissions/group..." >&6;} +rm -f conftest_grp +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +main() +{ + struct stat sb; + char *x,*ttyname(); + int om, m; + FILE *fp; + + if (!(x = ttyname(0))) exit(1); + if (stat(x, &sb)) exit(1); + om = sb.st_mode; + if (om & 002) exit(0); + m = system("mesg y"); + if (m == -1 || m == 127) exit(1); + if (stat(x, &sb)) exit(1); + m = sb.st_mode; + if (chmod(x, om)) exit(1); + if (m & 002) exit(0); + if (sb.st_gid == getgid()) exit(1); + if (!(fp=fopen("conftest_grp", "w"))) + exit(1); + fprintf(fp, "%d\n", sb.st_gid); + fclose(fp); + exit(0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + if test -f conftest_grp; then + ptygrp=`cat conftest_grp` + echo "- pty mode: $ptymode, group: $ptygrp" 1>&6 + + cat >>confdefs.h <<_ACEOF +#define PTYMODE $ptymode +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define PTYGROUP $ptygrp +_ACEOF + + else + echo "- ptys are world accessable" 1>&6 + + fi + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) + + WRITEPATH='' + XTERMPATH='' + # Extract the first word of "write", so it can be a program name with args. +set dummy write; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_WRITEPATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $WRITEPATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_WRITEPATH="$WRITEPATH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_WRITEPATH="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +WRITEPATH=$ac_cv_path_WRITEPATH + +if test -n "$WRITEPATH"; then + echo "$as_me:$LINENO: result: $WRITEPATH" >&5 +echo "${ECHO_T}$WRITEPATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "xterm", so it can be a program name with args. +set dummy xterm; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XTERMPATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $XTERMPATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_XTERMPATH="$XTERMPATH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_XTERMPATH="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +XTERMPATH=$ac_cv_path_XTERMPATH + +if test -n "$XTERMPATH"; then + echo "$as_me:$LINENO: result: $XTERMPATH" >&5 +echo "${ECHO_T}$XTERMPATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + found= + if test -n "$WRITEPATH$XTERMPATH"; then + findfollow= + lsfollow= + found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null` + if test -n "$found"; then + findfollow=-follow + lsfollow=L + fi + if test -n "$XTERMPATH"; then + ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'` + if test tty != "$ptygrpn"; then + XTERMPATH= + fi + fi + fi + if test -n "$WRITEPATH$XTERMPATH"; then + found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print` + if test -n "$found"; then + ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'` + echo "- pty mode: $ptymode, group: $ptygrp" 1>&6 + + cat >>confdefs.h <<_ACEOF +#define PTYMODE $ptymode +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define PTYGROUP $ptygrp +_ACEOF + + else + echo "- ptys are world accessable" 1>&6 + + fi + else + echo "- can't determine - assume ptys are world accessable" 1>&6 + + fi + + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest_grp +fi + +if test -n "$posix" ; then + +echo "assuming posix signal definition" 1>&6 + +cat >>confdefs.h <<\_ACEOF +#define SIGVOID 1 +_ACEOF + + +else + +{ echo "$as_me:$LINENO: checking return type of signal handlers..." >&5 +echo "$as_me: checking return type of signal handlers..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifdef signal +#undef signal +#endif +extern void (*signal ()) (); +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cat >>confdefs.h <<\_ACEOF +#define SIGVOID 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking sigset..." >&5 +echo "$as_me: checking sigset..." >&6;} +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + +#ifdef SIGVOID +sigset(0, (void (*)())0); +#else +sigset(0, (int (*)())0); +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cat >>confdefs.h <<\_ACEOF +#define USESIGSET 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking signal implementation..." >&5 +echo "$as_me: checking signal implementation..." >&6;} +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif +#ifdef USESIGSET +#define signal sigset +#endif + +int got; + +#ifdef SIGVOID +void +#endif +hand() +{ + got++; +} + +main() +{ + /* on hpux we use sigvec to get bsd signals */ +#ifdef __hpux + (void)signal(SIGCLD, hand); + kill(getpid(), SIGCLD); + kill(getpid(), SIGCLD); + if (got < 2) + exit(1); +#endif + exit(0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +cat >>confdefs.h <<\_ACEOF +#define SYSVSIGS 1 +_ACEOF + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi + + ac_config_files="$ac_config_files Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@VERSION@,$VERSION,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@AWK@,$AWK,;t t +s,@WRITEPATH@,$WRITEPATH,;t t +s,@XTERMPATH@,$XTERMPATH,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/readline/examples/rlfe/configure.in b/readline/examples/rlfe/configure.in new file mode 100644 index 0000000..ad68541 --- /dev/null +++ b/readline/examples/rlfe/configure.in @@ -0,0 +1,438 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(rlfe.c) +AC_CONFIG_HEADER(config.h) +VERSION=0.4 +AC_SUBST(VERSION) + +dnl +dnl Define some useful macros +dnl +AC_DEFUN(AC_PROGRAM_SOURCE, +[AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out" +. ./conftest.out +rm -f conftest* +])dnl +dnl +define(AC_NOTE, +[echo "$1" 1>&AC_FD_MSG +])dnl + +old_CFLAGS="$CFLAGS" +AC_PROG_CC +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL +AC_ISC_POSIX + +AC_TRY_RUN(main(){exit(0);},,[ +if test $CC != cc ; then +AC_NOTE(Your $CC failed - restarting with CC=cc) +AC_NOTE() +CC=cc +export CC +exec $0 $configure_args +fi +]) + +AC_TRY_RUN(main(){exit(0);},, +exec 5>&2 +eval $ac_link +AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;) +AC_NOTE($ac_compile) +AC_MSG_ERROR(Can't run the compiler - sorry)) + +AC_TRY_RUN([ +main() +{ + int __something_strange_(); + __something_strange_(0); +} +],AC_MSG_ERROR(Your compiler does not set the exit status - sorry)) + +AC_PROG_AWK + +if test -f etc/toolcheck; then +AC_CHECKING(for buggy tools) +sh etc/toolcheck 1>&AC_FD_MSG +fi + +dnl +dnl **** special unix variants **** +dnl + +AC_CHECKING(for System V) +AC_TRY_COMPILE( +[#include +#include +#include ], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV)) + +AC_CHECKING(for Solaris 2.x) +AC_EGREP_CPP(yes, +[#if defined(SVR4) && defined(sun) + yes +#endif +], LIBS="$LIBS -lsocket -lnsl -lkstat") + +dnl +dnl **** select() **** +dnl + +AC_CHECKING(select) +AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, +LIBS="$LIBS -lnet -lnsl" +AC_CHECKING(select with $LIBS) +AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, +AC_MSG_ERROR(!!! no select - no screen)) +) +dnl +dnl **** check the select implementation **** +dnl + +AC_CHECKING(select return value) +AC_TRY_RUN([ +#include +#include +#include + +char *nam = "/tmp/conftest$$"; + +#ifdef NAMEDPIPE + +#ifndef O_NONBLOCK +#define O_NONBLOCK O_NDELAY +#endif +#ifndef S_IFIFO +#define S_IFIFO 0010000 +#endif + + +main() +{ +#ifdef FD_SET + fd_set f; +#else + int f; +#endif + +#ifdef __FreeBSD__ +/* From Andrew A. Chernov (ache@astral.msk.su): + * opening RDWR fifo fails in BSD 4.4, but select return values are + * right. + */ + exit(0); +#endif + (void)alarm(5); +#ifdef POSIX + if (mkfifo(nam, 0777)) +#else + if (mknod(nam, S_IFIFO|0777, 0)) +#endif + exit(1); + close(0); + if (open(nam, O_RDWR | O_NONBLOCK)) + exit(1); + if (write(0, "TEST", 4) == -1) + exit(1); + +#else + +#include +#include +#include + +main() +{ + int s1, s2, l; + struct sockaddr_un a; +#ifdef FD_SET + fd_set f; +#else + int f; +#endif + + (void)alarm(5); + if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + exit(1); + a.sun_family = AF_UNIX; + strcpy(a.sun_path, nam); + (void) unlink(nam); + if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1) + exit(1); + if (listen(s1, 2)) + exit(1); + if (fork() == 0) + { + if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + kill(getppid(), 3); + (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2); + if (write(s2, "HELLO", 5) == -1) + kill(getppid(), 3); + exit(0); + } + l = sizeof(a); + close(0); + if (accept(s1, (struct sockaddr *)&a, &l)) + exit(1); +#endif + + +#ifdef FD_SET + FD_SET(0, &f); +#else + f = 1; +#endif + if (select(1, &f, 0, 0, 0) == -1) + exit(1); + if (select(1, &f, &f, 0, 0) != 2) + exit(1); + exit(0); +} +],AC_NOTE(- select is ok), +AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN)) + +dnl +dnl **** termcap or terminfo **** +dnl +AC_CHECKING(for tgetent) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, +olibs="$LIBS" +LIBS="-lcurses $olibs" +AC_CHECKING(libcurses) +AC_TRY_LINK(,[ +#ifdef __hpux +__sorry_hpux_libcurses_is_totally_broken_in_10_10(); +#else +tgetent((char *)0, (char *)0); +#endif +],, +LIBS="-ltermcap $olibs" +AC_CHECKING(libtermcap) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, +LIBS="-ltermlib $olibs" +AC_CHECKING(libtermlib) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, +LIBS="-lncurses $olibs" +AC_CHECKING(libncurses) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, +AC_MSG_ERROR(!!! no tgetent - no screen)))))) + +AC_TRY_RUN([ +main() +{ + exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); +}], AC_NOTE(- you use the termcap database), +AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO)) +AC_CHECKING(ospeed) +AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED)) + +dnl +dnl **** PTY specific things **** +dnl +AC_CHECKING(for /dev/ptc) +if test -r /dev/ptc; then +AC_DEFINE(HAVE_DEV_PTC) +fi + +AC_CHECKING(for SVR4 ptys) +sysvr4ptys= +if test -c /dev/ptmx ; then +AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS) +sysvr4ptys=1]) +fi + +AC_CHECK_FUNCS(getpt) + +dnl check for openpty() +if test -z "$sysvr4ptys"; then +AC_CHECK_FUNCS(openpty,, +[AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])]) +fi + +AC_CHECKING(for ptyranges) +if test -d /dev/ptym ; then +pdir='/dev/ptym' +else +pdir='/dev' +fi +dnl SCO uses ptyp%d +AC_EGREP_CPP(yes, +[#ifdef M_UNIX + yes; +#endif +], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`) +dnl if test -c /dev/ptyp19; then +dnl ptys=`echo /dev/ptyp??` +dnl else +dnl ptys=`echo $pdir/pty??` +dnl fi +if test "$ptys" != "$pdir/pty??" ; then +p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` +p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` +AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") +AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") +fi + +dnl **** pty mode/group handling **** +dnl +dnl support provided by Luke Mewburn , 931222 +AC_ARG_WITH(pty-mode, [ --with-pty-mode=mode default mode for ptys], [ ptymode="${withval}" ]) +AC_ARG_WITH(pty-group, [ --with-pty-group=group default group for ptys], [ ptygrp="${withval}" ]) +test -n "$ptymode" || ptymode=0620 +if test -n "$ptygrp" ; then +AC_DEFINE_UNQUOTED(PTYMODE, $ptymode) +AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) +else + +AC_CHECKING(default tty permissions/group) +rm -f conftest_grp +AC_TRY_RUN([ +#include +#include +#include +main() +{ + struct stat sb; + char *x,*ttyname(); + int om, m; + FILE *fp; + + if (!(x = ttyname(0))) exit(1); + if (stat(x, &sb)) exit(1); + om = sb.st_mode; + if (om & 002) exit(0); + m = system("mesg y"); + if (m == -1 || m == 127) exit(1); + if (stat(x, &sb)) exit(1); + m = sb.st_mode; + if (chmod(x, om)) exit(1); + if (m & 002) exit(0); + if (sb.st_gid == getgid()) exit(1); + if (!(fp=fopen("conftest_grp", "w"))) + exit(1); + fprintf(fp, "%d\n", sb.st_gid); + fclose(fp); + exit(0); +} +],[ + if test -f conftest_grp; then + ptygrp=`cat conftest_grp` + AC_NOTE([- pty mode: $ptymode, group: $ptygrp]) + AC_DEFINE_UNQUOTED(PTYMODE, $ptymode) + AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) + else + AC_NOTE(- ptys are world accessable) + fi +],[ + WRITEPATH='' + XTERMPATH='' + AC_PATH_PROG(WRITEPATH, write) + AC_PATH_PROG(XTERMPATH, xterm) + found= + if test -n "$WRITEPATH$XTERMPATH"; then + findfollow= + lsfollow= + found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null` + if test -n "$found"; then + findfollow=-follow + lsfollow=L + fi + if test -n "$XTERMPATH"; then + ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'` + if test tty != "$ptygrpn"; then + XTERMPATH= + fi + fi + fi + if test -n "$WRITEPATH$XTERMPATH"; then + found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print` + if test -n "$found"; then + ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'` + AC_NOTE([- pty mode: $ptymode, group: $ptygrp]) + AC_DEFINE_UNQUOTED(PTYMODE, $ptymode) + AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp) + else + AC_NOTE(- ptys are world accessable) + fi + else + AC_NOTE(- can't determine - assume ptys are world accessable) + fi + ] +) +rm -f conftest_grp +fi + +dnl +dnl **** signal handling **** +dnl +if test -n "$posix" ; then + +dnl POSIX has reliable signals with void return type. +AC_NOTE(assuming posix signal definition) +AC_DEFINE(SIGVOID) + +else + +AC_CHECKING(return type of signal handlers) +AC_TRY_COMPILE( +[#include +#include +#ifdef signal +#undef signal +#endif +extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID)) +AC_CHECKING(sigset) +AC_TRY_LINK([ +#include +#include +],[ +#ifdef SIGVOID +sigset(0, (void (*)())0); +#else +sigset(0, (int (*)())0); +#endif +], AC_DEFINE(USESIGSET)) +AC_CHECKING(signal implementation) +AC_TRY_RUN([ +#include +#include + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif +#ifdef USESIGSET +#define signal sigset +#endif + +int got; + +#ifdef SIGVOID +void +#endif +hand() +{ + got++; +} + +main() +{ + /* on hpux we use sigvec to get bsd signals */ +#ifdef __hpux + (void)signal(SIGCLD, hand); + kill(getpid(), SIGCLD); + kill(getpid(), SIGCLD); + if (got < 2) + exit(1); +#endif + exit(0); +} +],,AC_DEFINE(SYSVSIGS)) + +fi + +AC_OUTPUT(Makefile) diff --git a/readline/examples/rlfe/extern.h b/readline/examples/rlfe/extern.h new file mode 100644 index 0000000..2cace2c --- /dev/null +++ b/readline/examples/rlfe/extern.h @@ -0,0 +1,33 @@ +/* Copyright (c) 1993-2002 + * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) + * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) + * Copyright (c) 1987 Oliver Laumann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + * $Id$ FAU + */ + +#if !defined(__GNUC__) || __GNUC__ < 2 +#undef __attribute__ +#define __attribute__(x) +#endif + +/* pty.c */ +extern int OpenPTY __P((char **)); +extern void InitPTY __P((int)); + diff --git a/readline/examples/rlfe/os.h b/readline/examples/rlfe/os.h new file mode 100644 index 0000000..1994fe6 --- /dev/null +++ b/readline/examples/rlfe/os.h @@ -0,0 +1,530 @@ +/* Copyright (c) 1993-2002 + * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) + * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) + * Copyright (c) 1987 Oliver Laumann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + * $Id$ FAU + */ + +#include +#include + +#include + +/* In strict ANSI mode, HP-UX machines define __hpux but not hpux */ +#if defined(__hpux) && !defined(hpux) +# define hpux +#endif + +#if defined(__bsdi__) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) || defined(_IBMR2) || defined(linux) +# include +#endif /* __bsdi__ || __386BSD__ || _CX_UX || hpux || _IBMR2 || linux */ + +#ifdef ISC +# ifdef ENAMETOOLONG +# undef ENAMETOOLONG +# endif +# ifdef ENOTEMPTY +# undef ENOTEMPTY +# endif +# include +# include +#endif + +#ifdef sun +# define getpgrp __getpgrp +# define exit __exit +#endif +#ifdef POSIX +# include +# if defined(__STDC__) +# include +# endif /* __STDC__ */ +#endif /* POSIX */ +#ifdef sun +# undef getpgrp +# undef exit +#endif /* sun */ + +#ifndef linux /* all done in */ +extern int errno; +#endif /* linux */ +#ifndef HAVE_STRERROR +/* No macros, please */ +#undef strerror +#endif + +#if !defined(SYSV) && !defined(linux) +# ifdef NEWSOS +# define strlen ___strlen___ +# include +# undef strlen +# else /* NEWSOS */ +# include +# endif /* NEWSOS */ +#else /* SYSV */ +# if defined(SVR4) || defined(NEWSOS) +# define strlen ___strlen___ +# include +# undef strlen +# if !defined(NEWSOS) && !defined(__hpux) + extern size_t strlen(const char *); +# endif +# else /* SVR4 */ +# include +# endif /* SVR4 */ +#endif /* SYSV */ + +#ifdef USEVARARGS +# if defined(__STDC__) +# include +# define VA_LIST(var) va_list var; +# define VA_DOTS ... +# define VA_DECL +# define VA_START(ap, fmt) va_start(ap, fmt) +# define VA_ARGS(ap) ap +# define VA_END(ap) va_end(ap) +# else +# include +# define VA_LIST(var) va_list var; +# define VA_DOTS va_alist +# define VA_DECL va_dcl +# define VA_START(ap, fmt) va_start(ap) +# define VA_ARGS(ap) ap +# define VA_END(ap) va_end(ap) +# endif +#else +# define VA_LIST(var) +# define VA_DOTS p1, p2, p3, p4, p5, p6 +# define VA_DECL unsigned long VA_DOTS; +# define VA_START(ap, fmt) +# define VA_ARGS(ap) VA_DOTS +# define VA_END(ap) +# undef vsnprintf +# define vsnprintf xsnprintf +#endif + +#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX) +# include +#endif +#include + +#ifdef M_UNIX /* SCO */ +# include +# include +# define ftruncate(fd, s) chsize(fd, s) +#endif + +#ifdef SYSV +# define index strchr +# define rindex strrchr +# define bzero(poi,len) memset(poi,0,len) +# define bcmp memcmp +# define killpg(pgrp,sig) kill( -(pgrp), sig) +#endif + +#ifndef HAVE_GETCWD +# define getcwd(b,l) getwd(b) +#endif + +#ifndef USEBCOPY +# ifdef USEMEMMOVE +# define bcopy(s,d,len) memmove(d,s,len) +# else +# ifdef USEMEMCPY +# define bcopy(s,d,len) memcpy(d,s,len) +# else +# define NEED_OWN_BCOPY +# define bcopy xbcopy +# endif +# endif +#endif + +#ifdef hpux +# define setreuid(ruid, euid) setresuid(ruid, euid, -1) +# define setregid(rgid, egid) setresgid(rgid, egid, -1) +#endif + +#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) +# define USE_SETEUID +#endif + +#if !defined(HAVE__EXIT) && !defined(_exit) +#define _exit(x) exit(x) +#endif + +#ifndef HAVE_UTIMES +# define utimes utime +#endif + +#ifdef BUILTIN_TELNET +# include +# include +#endif + +#if defined(USE_LOCALE) && (!defined(HAVE_SETLOCALE) || !defined(HAVE_STRFTIME)) +# undef USE_LOCALE +#endif + +/***************************************************************** + * terminal handling + */ + +#ifdef POSIX +# include +# ifdef hpux +# include +# endif /* hpux */ +# ifdef NCCS +# define MAXCC NCCS +# else +# define MAXCC 256 +# endif +#else /* POSIX */ +# ifdef TERMIO +# include +# ifdef NCC +# define MAXCC NCC +# else +# define MAXCC 256 +# endif +# ifdef CYTERMIO +# include +# endif +# else /* TERMIO */ +# include +# endif /* TERMIO */ +#endif /* POSIX */ + +#ifndef VDISABLE +# ifdef _POSIX_VDISABLE +# define VDISABLE _POSIX_VDISABLE +# else +# define VDISABLE 0377 +# endif /* _POSIX_VDISABLE */ +#endif /* !VDISABLE */ + + +/* on sgi, regardless of the stream head's read mode (RNORM/RMSGN/RMSGD) + * TIOCPKT mode causes data loss if our buffer is too small (IOSIZE) + * to hold the whole packet at first read(). + * (Marc Boucher) + * + * matthew green: + * TIOCPKT is broken on dgux 5.4.1 generic AViiON mc88100 + * + * Joe Traister: On AIX4, programs like irc won't work if screen + * uses TIOCPKT (select fails to return on pty read). + */ +#if defined(sgi) || defined(DGUX) || defined(_IBMR2) +# undef TIOCPKT +#endif + +/* linux ncurses is broken, we have to use our own tputs */ +#if defined(linux) && defined(TERMINFO) +# define tputs xtputs +#endif + +/* Alexandre Oliva: SVR4 style ptys don't work with osf */ +#ifdef __osf__ +# undef HAVE_SVR4_PTYS +#endif + +/***************************************************************** + * utmp handling + */ + +#ifdef GETUTENT + typedef char *slot_t; +#else + typedef int slot_t; +#endif + +#if defined(UTMPOK) || defined(BUGGYGETLOGIN) +# if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux) +# include +# define UTMPFILE UTMPX_FILE +# define utmp utmpx +# define getutent getutxent +# define getutid getutxid +# define getutline getutxline +# define pututline pututxline +# define setutent setutxent +# define endutent endutxent +# define ut_time ut_xtime +# else /* SVR4 */ +# include +# endif /* SVR4 */ +# ifdef apollo + /* + * We don't have GETUTENT, so we dig into utmp ourselves. + * But we save the permanent filedescriptor and + * open utmp just when we need to. + * This code supports an unsorted utmp. jw. + */ +# define UTNOKEEP +# endif /* apollo */ + +# ifndef UTMPFILE +# ifdef UTMP_FILE +# define UTMPFILE UTMP_FILE +# else +# ifdef _PATH_UTMP +# define UTMPFILE _PATH_UTMP +# else +# define UTMPFILE "/etc/utmp" +# endif /* _PATH_UTMP */ +# endif +# endif + +#endif /* UTMPOK || BUGGYGETLOGIN */ + +#if !defined(UTMPOK) && defined(USRLIMIT) +# undef USRLIMIT +#endif + +#ifdef LOGOUTOK +# ifndef LOGINDEFAULT +# define LOGINDEFAULT 0 +# endif +#else +# ifdef LOGINDEFAULT +# undef LOGINDEFAULT +# endif +# define LOGINDEFAULT 1 +#endif + + +/***************************************************************** + * file stuff + */ + +#ifndef F_OK +#define F_OK 0 +#endif +#ifndef X_OK +#define X_OK 1 +#endif +#ifndef W_OK +#define W_OK 2 +#endif +#ifndef R_OK +#define R_OK 4 +#endif + +#ifndef S_IFIFO +#define S_IFIFO 0010000 +#endif +#ifndef S_IREAD +#define S_IREAD 0000400 +#endif +#ifndef S_IWRITE +#define S_IWRITE 0000200 +#endif +#ifndef S_IEXEC +#define S_IEXEC 0000100 +#endif + +#if defined(S_IFIFO) && defined(S_IFMT) && !defined(S_ISFIFO) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#endif +#if defined(S_IFSOCK) && defined(S_IFMT) && !defined(S_ISSOCK) +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) +#endif +#if defined(S_IFCHR) && defined(S_IFMT) && !defined(S_ISCHR) +#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#endif +#if defined(S_IFDIR) && defined(S_IFMT) && !defined(S_ISDIR) +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif +#if defined(S_IFLNK) && defined(S_IFMT) && !defined(S_ISLNK) +#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#endif + +/* + * SunOS 4.1.3: `man 2V open' has only one line that mentions O_NOBLOCK: + * + * O_NONBLOCK Same as O_NDELAY above. + * + * on the very same SunOS 4.1.3, I traced the open system call and found + * that an open("/dev/ttyy08", O_RDWR|O_NONBLOCK|O_NOCTTY) was blocked, + * whereas open("/dev/ttyy08", O_RDWR|O_NDELAY |O_NOCTTY) went through. + * + * For this simple reason I now favour O_NDELAY. jw. 4.5.95 + */ +#if defined(sun) && !defined(SVR4) +# undef O_NONBLOCK +#endif + +#if !defined(O_NONBLOCK) && defined(O_NDELAY) +# define O_NONBLOCK O_NDELAY +#endif + +#if !defined(FNBLOCK) && defined(FNONBLOCK) +# define FNBLOCK FNONBLOCK +#endif +#if !defined(FNBLOCK) && defined(FNDELAY) +# define FNBLOCK FNDELAY +#endif +#if !defined(FNBLOCK) && defined(O_NONBLOCK) +# define FNBLOCK O_NONBLOCK +#endif + +#ifndef POSIX +#undef mkfifo +#define mkfifo(n,m) mknod(n,S_IFIFO|(m),0) +#endif + +#if !defined(HAVE_LSTAT) && !defined(lstat) +# define lstat stat +#endif + +/***************************************************************** + * signal handling + */ + +#ifdef SIGVOID +# define SIGRETURN +# define sigret_t void +#else +# define SIGRETURN return 0; +# define sigret_t int +#endif + +/* Geeeee, reverse it? */ +#if defined(SVR4) || (defined(SYSV) && defined(ISC)) || defined(_AIX) || defined(linux) || defined(ultrix) || defined(__386BSD__) || defined(__bsdi__) || defined(POSIX) || defined(NeXT) +# define SIGHASARG +#endif + +#ifdef SIGHASARG +# define SIGPROTOARG (int) +# define SIGDEFARG (sigsig) int sigsig; +# define SIGARG 0 +#else +# define SIGPROTOARG (void) +# define SIGDEFARG () +# define SIGARG +#endif + +#ifndef SIGCHLD +#define SIGCHLD SIGCLD +#endif + +#if defined(POSIX) || defined(hpux) +# define signal xsignal +#else +# ifdef USESIGSET +# define signal sigset +# endif /* USESIGSET */ +#endif + +/* used in screen.c and attacher.c */ +#ifndef NSIG /* kbeal needs these w/o SYSV */ +# define NSIG 32 +#endif /* !NSIG */ + + +/***************************************************************** + * Wait stuff + */ + +#if (!defined(sysV68) && !defined(M_XENIX)) || defined(NeXT) || defined(M_UNIX) +# include +#endif + +#ifndef WTERMSIG +# ifndef BSDWAIT /* if wait is NOT a union: */ +# define WTERMSIG(status) (status & 0177) +# else +# define WTERMSIG(status) status.w_T.w_Termsig +# endif +#endif + +#ifndef WSTOPSIG +# ifndef BSDWAIT /* if wait is NOT a union: */ +# define WSTOPSIG(status) ((status >> 8) & 0377) +# else +# define WSTOPSIG(status) status.w_S.w_Stopsig +# endif +#endif + +/* NET-2 uses WCOREDUMP */ +#if defined(WCOREDUMP) && !defined(WIFCORESIG) +# define WIFCORESIG(status) WCOREDUMP(status) +#endif + +#ifndef WIFCORESIG +# ifndef BSDWAIT /* if wait is NOT a union: */ +# define WIFCORESIG(status) (status & 0200) +# else +# define WIFCORESIG(status) status.w_T.w_Coredump +# endif +#endif + +#ifndef WEXITSTATUS +# ifndef BSDWAIT /* if wait is NOT a union: */ +# define WEXITSTATUS(status) ((status >> 8) & 0377) +# else +# define WEXITSTATUS(status) status.w_T.w_Retcode +# endif +#endif + + +/***************************************************************** + * select stuff + */ + +#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_) +#include /* for timeval + FD... */ +#endif + +/* + * SunOS 3.5 - Tom Schmidt - Micron Semiconductor, Inc - 27-Jul-93 + * tschmidt@vax.micron.com + */ +#ifndef FD_SET +# ifndef SUNOS3 +typedef struct fd_set { int fds_bits[1]; } fd_set; +# endif +# define FD_ZERO(fd) ((fd)->fds_bits[0] = 0) +# define FD_SET(b, fd) ((fd)->fds_bits[0] |= 1 << (b)) +# define FD_ISSET(b, fd) ((fd)->fds_bits[0] & 1 << (b)) +# define FD_SETSIZE 32 +#endif + + +/***************************************************************** + * user defineable stuff + */ + +#ifndef TERMCAP_BUFSIZE +# define TERMCAP_BUFSIZE 2048 +#endif + +#ifndef MAXPATHLEN +# define MAXPATHLEN 1024 +#endif + +/* + * you may try to vary this value. Use low values if your (VMS) system + * tends to choke when pasting. Use high values if you want to test + * how many characters your pty's can buffer. + */ +#define IOSIZE 4096 + diff --git a/readline/examples/rlfe/pty.c b/readline/examples/rlfe/pty.c new file mode 100644 index 0000000..f89d44c --- /dev/null +++ b/readline/examples/rlfe/pty.c @@ -0,0 +1,387 @@ +/* Copyright (c) 1993-2002 + * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) + * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) + * Copyright (c) 1987 Oliver Laumann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + */ + +#include +#include +#include +#include + +#include "config.h" +#include "screen.h" + +#ifndef sun +# include +#endif + +/* for solaris 2.1, Unixware (SVR4.2) and possibly others */ +#ifdef HAVE_SVR4_PTYS +# include +#endif + +#if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL) +# include +#endif + +#ifdef ISC +# include +# include +# include +#endif + +#ifdef sgi +# include +#endif /* sgi */ + +#include "extern.h" + +/* + * if no PTYRANGE[01] is in the config file, we pick a default + */ +#ifndef PTYRANGE0 +# define PTYRANGE0 "qpr" +#endif +#ifndef PTYRANGE1 +# define PTYRANGE1 "0123456789abcdef" +#endif + +/* SVR4 pseudo ttys don't seem to work with SCO-5 */ +#ifdef M_UNIX +# undef HAVE_SVR4_PTYS +#endif + +extern int eff_uid; + +/* used for opening a new pty-pair: */ +static char PtyName[32], TtyName[32]; + +#if !(defined(sequent) || defined(_SEQUENT_) || defined(HAVE_SVR4_PTYS)) +# ifdef hpux +static char PtyProto[] = "/dev/ptym/ptyXY"; +static char TtyProto[] = "/dev/pty/ttyXY"; +# else +# ifdef M_UNIX +static char PtyProto[] = "/dev/ptypXY"; +static char TtyProto[] = "/dev/ttypXY"; +# else +static char PtyProto[] = "/dev/ptyXY"; +static char TtyProto[] = "/dev/ttyXY"; +# endif +# endif /* hpux */ +#endif + +static void initmaster __P((int)); + +#if defined(sun) +/* sun's utmp_update program opens the salve side, thus corrupting + */ +int pty_preopen = 1; +#else +int pty_preopen = 0; +#endif + +/* + * Open all ptys with O_NOCTTY, just to be on the safe side + * (RISCos mips breaks otherwise) + */ +#ifndef O_NOCTTY +# define O_NOCTTY 0 +#endif + +/***************************************************************/ + +static void +initmaster(f) +int f; +{ +#ifdef POSIX + tcflush(f, TCIOFLUSH); +#else +# ifdef TIOCFLUSH + (void) ioctl(f, TIOCFLUSH, (char *) 0); +# endif +#endif +#ifdef LOCKPTY + (void) ioctl(f, TIOCEXCL, (char *) 0); +#endif +} + +void +InitPTY(f) +int f; +{ + if (f < 0) + return; +#if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__osf__) && !defined(M_UNIX) + if (ioctl(f, I_PUSH, "ptem")) + Panic(errno, "InitPTY: cannot I_PUSH ptem"); + if (ioctl(f, I_PUSH, "ldterm")) + Panic(errno, "InitPTY: cannot I_PUSH ldterm"); +# ifdef sun + if (ioctl(f, I_PUSH, "ttcompat")) + Panic(errno, "InitPTY: cannot I_PUSH ttcompat"); +# endif +#endif +} + +/***************************************************************/ + +#if defined(OSX) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + register int f; + if ((f = open_controlling_pty(TtyName)) < 0) + return -1; + initmaster(f); + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + +#if (defined(sequent) || defined(_SEQUENT_)) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + char *m, *s; + register int f; + + if ((f = getpseudotty(&s, &m)) < 0) + return -1; +#ifdef _SEQUENT_ + fvhangup(s); +#endif + strncpy(PtyName, m, sizeof(PtyName)); + strncpy(TtyName, s, sizeof(TtyName)); + initmaster(f); + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + +#if defined(__sgi) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + int f; + char *name, *_getpty(); + sigret_t (*sigcld)__P(SIGPROTOARG); + + /* + * SIGCHLD set to SIG_DFL for _getpty() because it may fork() and + * exec() /usr/adm/mkpts + */ + sigcld = signal(SIGCHLD, SIG_DFL); + name = _getpty(&f, O_RDWR | O_NONBLOCK, 0600, 0); + signal(SIGCHLD, sigcld); + + if (name == 0) + return -1; + initmaster(f); + *ttyn = name; + return f; +} +#endif + +/***************************************************************/ + +#if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + register int f; + struct stat buf; + + strcpy(PtyName, "/dev/ptc"); + if ((f = open(PtyName, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) + return -1; + if (fstat(f, &buf) < 0) + { + close(f); + return -1; + } + sprintf(TtyName, "/dev/ttyq%d", minor(buf.st_rdev)); + initmaster(f); + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + +#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + register int f; + char *m, *ptsname(); + int unlockpt __P((int)), grantpt __P((int)); +#if defined(HAVE_GETPT) && defined(linux) + int getpt __P((void)); +#endif + sigret_t (*sigcld)__P(SIGPROTOARG); + + strcpy(PtyName, "/dev/ptmx"); +#if defined(HAVE_GETPT) && defined(linux) + if ((f = getpt()) == -1) +#else + if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1) +#endif + return -1; + + /* + * SIGCHLD set to SIG_DFL for grantpt() because it fork()s and + * exec()s pt_chmod + */ + sigcld = signal(SIGCHLD, SIG_DFL); + if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f)) + { + signal(SIGCHLD, sigcld); + close(f); + return -1; + } + signal(SIGCHLD, sigcld); + strncpy(TtyName, m, sizeof(TtyName)); + initmaster(f); + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + +#if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE) +#define PTY_DONE + +int +OpenPTY(ttyn) +char **ttyn; +{ + register int f; + + /* a dumb looking loop replaced by mycrofts code: */ + strcpy (PtyName, "/dev/ptc"); + if ((f = open (PtyName, O_RDWR | O_NOCTTY)) < 0) + return -1; + strncpy(TtyName, ttyname(f), sizeof(TtyName)); + if (eff_uid && access(TtyName, R_OK | W_OK)) + { + close(f); + return -1; + } + initmaster(f); +# ifdef _IBMR2 + pty_preopen = 1; +# endif + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + +#if defined(HAVE_OPENPTY) && !defined(PTY_DONE) +#define PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + int f, s; + if (openpty(&f, &s, TtyName, NULL, NULL) != 0) + return -1; + close(s); + initmaster(f); + pty_preopen = 1; + *ttyn = TtyName; + return f; +} +#endif + +/***************************************************************/ + +#ifndef PTY_DONE +int +OpenPTY(ttyn) +char **ttyn; +{ + register char *p, *q, *l, *d; + register int f; + + debug("OpenPTY: Using BSD style ptys.\n"); + strcpy(PtyName, PtyProto); + strcpy(TtyName, TtyProto); + for (p = PtyName; *p != 'X'; p++) + ; + for (q = TtyName; *q != 'X'; q++) + ; + for (l = PTYRANGE0; (*p = *l) != '\0'; l++) + { + for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++) + { + debug1("OpenPTY tries '%s'\n", PtyName); + if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1) + continue; + q[0] = *l; + q[1] = *d; + if (eff_uid && access(TtyName, R_OK | W_OK)) + { + close(f); + continue; + } +#if defined(sun) && defined(TIOCGPGRP) && !defined(SUNOS3) + /* Hack to ensure that the slave side of the pty is + * unused. May not work in anything other than SunOS4.1 + */ + { + int pgrp; + + /* tcgetpgrp does not work (uses TIOCGETPGRP)! */ + if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO) + { + close(f); + continue; + } + } +#endif + initmaster(f); + *ttyn = TtyName; + return f; + } + } + return -1; +} +#endif + diff --git a/readline/examples/rlfe/rlfe.c b/readline/examples/rlfe/rlfe.c new file mode 100644 index 0000000..6d747dc --- /dev/null +++ b/readline/examples/rlfe/rlfe.c @@ -0,0 +1,780 @@ +/* A front-end using readline to "cook" input lines. + * + * Copyright (C) 2004, 1999 Per Bothner + * + * This front-end program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * Some code from Johnson & Troan: "Linux Application Development" + * (Addison-Wesley, 1998) was used directly or for inspiration. + * + * 2003-11-07 Wolfgang Taeuber + * Specify a history file and the size of the history file with command + * line options; use EDITOR/VISUAL to set vi/emacs preference. + */ + +/* PROBLEMS/TODO: + * + * Only tested under GNU/Linux and Mac OS 10.x; needs to be ported. + * + * Switching between line-editing-mode vs raw-char-mode depending on + * what tcgetattr returns is inherently not robust, plus it doesn't + * work when ssh/telnetting in. A better solution is possible if the + * tty system can send in-line escape sequences indicating the current + * mode, echo'd input, etc. That would also allow a user preference + * to set different colors for prompt, input, stdout, and stderr. + * + * When running mc -c under the Linux console, mc does not recognize + * mouse clicks, which mc does when not running under rlfe. + * + * Pasting selected text containing tabs is like hitting the tab character, + * which invokes readline completion. We don't want this. I don't know + * if this is fixable without integrating rlfe into a terminal emulator. + * + * Echo suppression is a kludge, but can only be avoided with better kernel + * support: We need a tty mode to disable "real" echoing, while still + * letting the inferior think its tty driver to doing echoing. + * Stevens's book claims SCR$ and BSD4.3+ have TIOCREMOTE. + * + * The latest readline may have some hooks we can use to avoid having + * to back up the prompt. (See HAVE_ALREADY_PROMPTED.) + * + * Desirable readline feature: When in cooked no-echo mode (e.g. password), + * echo characters are they are types with '*', but remove them when done. + * + * Asynchronous output while we're editing an input line should be + * inserted in the output view *before* the input line, so that the + * lines being edited (with the prompt) float at the end of the input. + * + * A "page mode" option to emulate more/less behavior: At each page of + * output, pause for a user command. This required parsing the output + * to keep track of line lengths. It also requires remembering the + * output, if we want an option to scroll back, which suggests that + * this should be integrated with a terminal emulator like xterm. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" + +#ifdef READLINE_LIBRARY +# include "readline.h" +# include "history.h" +#else +# include +# include +#endif + +#ifndef COMMAND +#define COMMAND "/bin/bash" +#endif +#ifndef COMMAND_ARGS +#define COMMAND_ARGS COMMAND +#endif + +#ifndef ALT_COMMAND +#define ALT_COMMAND "/bin/sh" +#endif +#ifndef ALT_COMMAND_ARGS +#define ALT_COMMAND_ARGS ALT_COMMAND +#endif + +#ifndef HAVE_MEMMOVE +# if __GNUC__ > 1 +# define memmove(d, s, n) __builtin_memcpy(d, s, n) +# else +# define memmove(d, s, n) memcpy(d, s, n) +# endif +#else +# define memmove(d, s, n) memcpy(d, s, n) +#endif + +#define APPLICATION_NAME "rlfe" + +static int in_from_inferior_fd; +static int out_to_inferior_fd; +static void set_edit_mode (); +static void usage_exit (); +static char *hist_file = 0; +static int hist_size = 0; + +/* Unfortunately, we cannot safely display echo from the inferior process. + The reason is that the echo bit in the pty is "owned" by the inferior, + and if we try to turn it off, we could confuse the inferior. + Thus, when echoing, we get echo twice: First readline echoes while + we're actually editing. Then we send the line to the inferior, and the + terminal driver send back an extra echo. + The work-around is to remember the input lines, and when we see that + line come back, we supress the output. + A better solution (supposedly available on SVR4) would be a smarter + terminal driver, with more flags ... */ +#define ECHO_SUPPRESS_MAX 1024 +char echo_suppress_buffer[ECHO_SUPPRESS_MAX]; +int echo_suppress_start = 0; +int echo_suppress_limit = 0; + +/*#define DEBUG*/ + +#ifdef DEBUG +FILE *logfile = NULL; +#define DPRINT0(FMT) (fprintf(logfile, FMT), fflush(logfile)) +#define DPRINT1(FMT, V1) (fprintf(logfile, FMT, V1), fflush(logfile)) +#define DPRINT2(FMT, V1, V2) (fprintf(logfile, FMT, V1, V2), fflush(logfile)) +#else +#define DPRINT0(FMT) ((void) 0) /* Do nothing */ +#define DPRINT1(FMT, V1) ((void) 0) /* Do nothing */ +#define DPRINT2(FMT, V1, V2) ((void) 0) /* Do nothing */ +#endif + +struct termios orig_term; + +/* Pid of child process. */ +static pid_t child = -1; + +static void +sig_child (int signo) +{ + int status; + wait (&status); + if (hist_file != 0) + { + write_history (hist_file); + if (hist_size) + history_truncate_file (hist_file, hist_size); + } + DPRINT0 ("(Child process died.)\n"); + tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); + exit (0); +} + +volatile int propagate_sigwinch = 0; + +/* sigwinch_handler + * propagate window size changes from input file descriptor to + * master side of pty. + */ +void sigwinch_handler(int signal) { + propagate_sigwinch = 1; +} + + +/* get_slave_pty() returns an integer file descriptor. + * If it returns < 0, an error has occurred. + * Otherwise, it has returned the slave file descriptor. + */ + +int get_slave_pty(char *name) { + struct group *gptr; + gid_t gid; + int slave = -1; + + /* chown/chmod the corresponding pty, if possible. + * This will only work if the process has root permissions. + * Alternatively, write and exec a small setuid program that + * does just this. + */ + if ((gptr = getgrnam("tty")) != 0) { + gid = gptr->gr_gid; + } else { + /* if the tty group does not exist, don't change the + * group on the slave pty, only the owner + */ + gid = -1; + } + + /* Note that we do not check for errors here. If this is code + * where these actions are critical, check for errors! + */ + chown(name, getuid(), gid); + /* This code only makes the slave read/writeable for the user. + * If this is for an interactive shell that will want to + * receive "write" and "wall" messages, OR S_IWGRP into the + * second argument below. + */ + chmod(name, S_IRUSR|S_IWUSR); + + /* open the corresponding slave pty */ + slave = open(name, O_RDWR); + return (slave); +} + +/* Certain special characters, such as ctrl/C, we want to pass directly + to the inferior, rather than letting readline handle them. */ + +static char special_chars[20]; +static int special_chars_count; + +static void +add_special_char(int ch) +{ + if (ch != 0) + special_chars[special_chars_count++] = ch; +} + +static int eof_char; + +static int +is_special_char(int ch) +{ + int i; +#if 0 + if (ch == eof_char && rl_point == rl_end) + return 1; +#endif + for (i = special_chars_count; --i >= 0; ) + if (special_chars[i] == ch) + return 1; + return 0; +} + +static char buf[1024]; +/* buf[0 .. buf_count-1] is the what has been emitted on the current line. + It is used as the readline prompt. */ +static int buf_count = 0; + +int do_emphasize_input = 1; +int current_emphasize_input; + +char *start_input_mode = "\033[1m"; +char *end_input_mode = "\033[0m"; + +int num_keys = 0; + +static void maybe_emphasize_input (int on) +{ + if (on == current_emphasize_input + || (on && ! do_emphasize_input)) + return; + fprintf (rl_outstream, on ? start_input_mode : end_input_mode); + fflush (rl_outstream); + current_emphasize_input = on; +} + +static void +null_prep_terminal (int meta) +{ +} + +static void +null_deprep_terminal () +{ + maybe_emphasize_input (0); +} + +static int +pre_input_change_mode (void) +{ + return 0; +} + +char pending_special_char; + +static void +line_handler (char *line) +{ + if (line == NULL) + { + char buf[1]; + DPRINT0("saw eof!\n"); + buf[0] = '\004'; /* ctrl/d */ + write (out_to_inferior_fd, buf, 1); + } + else + { + static char enter[] = "\r"; + /* Send line to inferior: */ + int length = strlen (line); + if (length > ECHO_SUPPRESS_MAX-2) + { + echo_suppress_start = 0; + echo_suppress_limit = 0; + } + else + { + if (echo_suppress_limit + length > ECHO_SUPPRESS_MAX - 2) + { + if (echo_suppress_limit - echo_suppress_start + length + <= ECHO_SUPPRESS_MAX - 2) + { + memmove (echo_suppress_buffer, + echo_suppress_buffer + echo_suppress_start, + echo_suppress_limit - echo_suppress_start); + echo_suppress_limit -= echo_suppress_start; + echo_suppress_start = 0; + } + else + { + echo_suppress_limit = 0; + } + echo_suppress_start = 0; + } + memcpy (echo_suppress_buffer + echo_suppress_limit, + line, length); + echo_suppress_limit += length; + echo_suppress_buffer[echo_suppress_limit++] = '\r'; + echo_suppress_buffer[echo_suppress_limit++] = '\n'; + } + write (out_to_inferior_fd, line, length); + if (pending_special_char == 0) + { + write (out_to_inferior_fd, enter, sizeof(enter)-1); + if (*line) + add_history (line); + } + free (line); + } + rl_callback_handler_remove (); + buf_count = 0; + num_keys = 0; + if (pending_special_char != 0) + { + write (out_to_inferior_fd, &pending_special_char, 1); + pending_special_char = 0; + } +} + +/* Value of rl_getc_function. + Use this because readline should read from stdin, not rl_instream, + points to the pty (so readline has monitor its terminal modes). */ + +int +my_rl_getc (FILE *dummy) +{ + int ch = rl_getc (stdin); + if (is_special_char (ch)) + { + pending_special_char = ch; + return '\r'; + } + return ch; +} + +int +main(int argc, char** argv) +{ + char *path; + int i; + int master; + char *name; + int in_from_tty_fd; + struct sigaction act; + struct winsize ws; + struct termios t; + int maxfd; + fd_set in_set; + static char empty_string[1] = ""; + char *prompt = empty_string; + int ioctl_err = 0; + int arg_base = 1; + +#ifdef DEBUG + logfile = fopen("/tmp/rlfe.log", "w"); +#endif + + while (arg_base= argc ) + usage_exit(); + switch(argv[arg_base][1]) + { + case 'h': + arg_base++; + hist_file = argv[arg_base]; + break; + case 's': + arg_base++; + hist_size = atoi(argv[arg_base]); + if (hist_size<0) + usage_exit(); + break; + default: + usage_exit(); + } + arg_base++; + } + if (hist_file) + read_history (hist_file); + + set_edit_mode (); + + rl_readline_name = APPLICATION_NAME; + + if ((master = OpenPTY (&name)) < 0) + { + perror("ptypair: could not open master pty"); + exit(1); + } + + DPRINT1("pty name: '%s'\n", name); + + /* set up SIGWINCH handler */ + act.sa_handler = sigwinch_handler; + sigemptyset(&(act.sa_mask)); + act.sa_flags = 0; + if (sigaction(SIGWINCH, &act, NULL) < 0) + { + perror("ptypair: could not handle SIGWINCH "); + exit(1); + } + + if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) < 0) + { + perror("ptypair: could not get window size"); + exit(1); + } + + if ((child = fork()) < 0) + { + perror("cannot fork"); + exit(1); + } + + if (child == 0) + { + int slave; /* file descriptor for slave pty */ + + /* We are in the child process */ + close(master); + +#ifdef TIOCSCTTY + if ((slave = get_slave_pty(name)) < 0) + { + perror("ptypair: could not open slave pty"); + exit(1); + } +#endif + + /* We need to make this process a session group leader, because + * it is on a new PTY, and things like job control simply will + * not work correctly unless there is a session group leader + * and process group leader (which a session group leader + * automatically is). This also disassociates us from our old + * controlling tty. + */ + if (setsid() < 0) + { + perror("could not set session leader"); + } + + /* Tie us to our new controlling tty. */ +#ifdef TIOCSCTTY + if (ioctl(slave, TIOCSCTTY, NULL)) + { + perror("could not set new controlling tty"); + } +#else + if ((slave = get_slave_pty(name)) < 0) + { + perror("ptypair: could not open slave pty"); + exit(1); + } +#endif + + /* make slave pty be standard in, out, and error */ + dup2(slave, STDIN_FILENO); + dup2(slave, STDOUT_FILENO); + dup2(slave, STDERR_FILENO); + + /* at this point the slave pty should be standard input */ + if (slave > 2) + { + close(slave); + } + + /* Try to restore window size; failure isn't critical */ + if (ioctl(STDOUT_FILENO, TIOCSWINSZ, &ws) < 0) + { + perror("could not restore window size"); + } + + /* now start the shell */ + { + static char* command_args[] = { COMMAND_ARGS, NULL }; + static char* alt_command_args[] = { ALT_COMMAND_ARGS, NULL }; + if (argc <= 1) + { + execvp (COMMAND, command_args); + execvp (ALT_COMMAND, alt_command_args); + } + else + execvp (argv[arg_base], &argv[arg_base]); + } + + /* should never be reached */ + exit(1); + } + + /* parent */ + signal (SIGCHLD, sig_child); + + /* Note that we only set termios settings for standard input; + * the master side of a pty is NOT a tty. + */ + tcgetattr(STDIN_FILENO, &orig_term); + + t = orig_term; + eof_char = t.c_cc[VEOF]; + /* add_special_char(t.c_cc[VEOF]);*/ + add_special_char(t.c_cc[VINTR]); + add_special_char(t.c_cc[VQUIT]); + add_special_char(t.c_cc[VSUSP]); +#if defined (VDISCARD) + add_special_char(t.c_cc[VDISCARD]); +#endif + + t.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOCTL | ECHOE | \ + ECHOK | ECHOKE | ECHONL | ECHOPRT ); + t.c_iflag &= ~ICRNL; + t.c_iflag |= IGNBRK; + t.c_cc[VMIN] = 1; + t.c_cc[VTIME] = 0; + tcsetattr(STDIN_FILENO, TCSANOW, &t); + in_from_inferior_fd = master; + out_to_inferior_fd = master; + rl_instream = fdopen (master, "r"); + rl_getc_function = my_rl_getc; + + rl_prep_term_function = null_prep_terminal; + rl_deprep_term_function = null_deprep_terminal; + rl_pre_input_hook = pre_input_change_mode; + rl_callback_handler_install (prompt, line_handler); + + in_from_tty_fd = STDIN_FILENO; + FD_ZERO (&in_set); + maxfd = in_from_inferior_fd > in_from_tty_fd ? in_from_inferior_fd + : in_from_tty_fd; + for (;;) + { + int num; + FD_SET (in_from_inferior_fd, &in_set); + FD_SET (in_from_tty_fd, &in_set); + + num = select(maxfd+1, &in_set, NULL, NULL, NULL); + + if (propagate_sigwinch) + { + struct winsize ws; + if (ioctl (STDIN_FILENO, TIOCGWINSZ, &ws) >= 0) + { + ioctl (master, TIOCSWINSZ, &ws); + } + propagate_sigwinch = 0; + continue; + } + + if (num <= 0) + { + perror ("select"); + exit (-1); + } + if (FD_ISSET (in_from_tty_fd, &in_set)) + { + extern int readline_echoing_p; + struct termios term_master; + int do_canon = 1; + int do_icrnl = 1; + int ioctl_ret; + + DPRINT1("[tty avail num_keys:%d]\n", num_keys); + + /* If we can't get tty modes for the master side of the pty, we + can't handle non-canonical-mode programs. Always assume the + master is in canonical echo mode if we can't tell. */ + ioctl_ret = tcgetattr(master, &term_master); + + if (ioctl_ret >= 0) + { + do_canon = (term_master.c_lflag & ICANON) != 0; + do_icrnl = (term_master.c_lflag & ICRNL) != 0; + readline_echoing_p = (term_master.c_lflag & ECHO) != 0; + DPRINT1 ("echo,canon,crnl:%03d\n", + 100 * readline_echoing_p + + 10 * do_canon + + 1 * do_icrnl); + } + else + { + if (ioctl_err == 0) + DPRINT1("tcgetattr on master fd failed: errno = %d\n", errno); + ioctl_err = 1; + } + + if (do_canon == 0 && num_keys == 0) + { + char ch[10]; + int count = read (STDIN_FILENO, ch, sizeof(ch)); + DPRINT1("[read %d chars from stdin: ", count); + DPRINT2(" \"%.*s\"]\n", count, ch); + if (do_icrnl) + { + int i = count; + while (--i >= 0) + { + if (ch[i] == '\r') + ch[i] = '\n'; + } + } + maybe_emphasize_input (1); + write (out_to_inferior_fd, ch, count); + } + else + { + if (num_keys == 0) + { + int i; + /* Re-install callback handler for new prompt. */ + if (prompt != empty_string) + free (prompt); + if (prompt == NULL) + { + DPRINT0("New empty prompt\n"); + prompt = empty_string; + } + else + { + if (do_emphasize_input && buf_count > 0) + { + prompt = malloc (buf_count + strlen (end_input_mode) + + strlen (start_input_mode) + 5); + sprintf (prompt, "\001%s\002%.*s\001%s\002", + end_input_mode, + buf_count, buf, + start_input_mode); + } + else + { + prompt = malloc (buf_count + 1); + memcpy (prompt, buf, buf_count); + prompt[buf_count] = '\0'; + } + DPRINT1("New prompt '%s'\n", prompt); +#if 0 /* ifdef HAVE_RL_ALREADY_PROMPTED */ + /* Doesn't quite work when do_emphasize_input is 1. */ + rl_already_prompted = buf_count > 0; +#else + if (buf_count > 0) + write (1, "\r", 1); +#endif + } + + rl_callback_handler_install (prompt, line_handler); + } + num_keys++; + maybe_emphasize_input (1); + rl_callback_read_char (); + } + } + else /* output from inferior. */ + { + int i; + int count; + int old_count; + if (buf_count > (sizeof(buf) >> 2)) + buf_count = 0; + count = read (in_from_inferior_fd, buf+buf_count, + sizeof(buf) - buf_count); + DPRINT2("read %d from inferior, buf_count=%d", count, buf_count); + DPRINT2(": \"%.*s\"", count, buf+buf_count); + maybe_emphasize_input (0); + if (count <= 0) + { + DPRINT0 ("(Connection closed by foreign host.)\n"); + tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); + exit (0); + } + old_count = buf_count; + + /* Look for any pending echo that we need to suppress. */ + while (echo_suppress_start < echo_suppress_limit + && count > 0 + && buf[buf_count] == echo_suppress_buffer[echo_suppress_start]) + { + count--; + buf_count++; + echo_suppress_start++; + } + DPRINT1("suppressed %d characters of echo.\n", buf_count-old_count); + + /* Write to the terminal anything that was not suppressed. */ + if (count > 0) + write (1, buf + buf_count, count); + + /* Finally, look for a prompt candidate. + * When we get around to going input (from the keyboard), + * we will consider the prompt to be anything since the last + * line terminator. So we need to save that text in the + * initial part of buf. However, anything before the + * most recent end-of-line is not interesting. */ + buf_count += count; +#if 1 + for (i = buf_count; --i >= old_count; ) +#else + for (i = buf_count - 1; i-- >= buf_count - count; ) +#endif + { + if (buf[i] == '\n' || buf[i] == '\r') + { + i++; + memmove (buf, buf+i, buf_count - i); + buf_count -= i; + break; + } + } + DPRINT2("-> i: %d, buf_count: %d\n", i, buf_count); + } + } +} + +static void set_edit_mode () +{ + int vi = 0; + char *shellopts; + + shellopts = getenv ("SHELLOPTS"); + while (shellopts != 0) + { + if (strncmp ("vi", shellopts, 2) == 0) + { + vi = 1; + break; + } + shellopts = index (shellopts + 1, ':'); + } + + if (!vi) + { + if (getenv ("EDITOR") != 0) + vi |= strcmp (getenv ("EDITOR"), "vi") == 0; + } + + if (vi) + rl_variable_bind ("editing-mode", "vi"); + else + rl_variable_bind ("editing-mode", "emacs"); +} + + +static void usage_exit () +{ + fprintf (stderr, "Usage: rlfe [-h histfile] [-s size] cmd [arg1] [arg2] ...\n\n"); + exit (1); +} diff --git a/readline/examples/rlfe/screen.h b/readline/examples/rlfe/screen.h new file mode 100644 index 0000000..5b040c3 --- /dev/null +++ b/readline/examples/rlfe/screen.h @@ -0,0 +1,2 @@ +/* Dummy header to avoid modifying pty.c */ +#include "os.h" diff --git a/readline/examples/rlptytest.c b/readline/examples/rlptytest.c new file mode 100644 index 0000000..79257db --- /dev/null +++ b/readline/examples/rlptytest.c @@ -0,0 +1,337 @@ +/* + * + * Another test harness for the readline callback interface. + * + * Author: Bob Rossi + */ + +#if defined (HAVE_CONFIG_H) +#include +#endif + +#include +#include +#include +#include + +#include +#include + +#include + +#if 0 /* LINUX */ +#include +#else +#include +#endif + +#ifdef READLINE_LIBRARY +# include "readline.h" +#else +# include +#endif + +/** + * Master/Slave PTY used to keep readline off of stdin/stdout. + */ +static int masterfd = -1; +static int slavefd; + +void +sigint (s) + int s; +{ + tty_reset (STDIN_FILENO); + close (masterfd); + close (slavefd); + printf ("\n"); + exit (0); +} + +static int +user_input() +{ + int size; + const int MAX = 1024; + char *buf = (char *)malloc(MAX+1); + + size = read (STDIN_FILENO, buf, MAX); + if (size == -1) + return -1; + + size = write (masterfd, buf, size); + if (size == -1) + return -1; + + return 0; +} + +static int +readline_input() +{ + const int MAX = 1024; + char *buf = (char *)malloc(MAX+1); + int size; + + size = read (masterfd, buf, MAX); + if (size == -1) + { + free( buf ); + buf = NULL; + return -1; + } + + buf[size] = 0; + + /* Display output from readline */ + if ( size > 0 ) + fprintf(stderr, "%s", buf); + + free( buf ); + buf = NULL; + return 0; +} + +static void +rlctx_send_user_command(char *line) +{ + /* This happens when rl_callback_read_char gets EOF */ + if ( line == NULL ) + return; + + if (strcmp (line, "exit") == 0) { + tty_reset (STDIN_FILENO); + close (masterfd); + close (slavefd); + printf ("\n"); + exit (0); + } + + /* Don't add the enter command */ + if ( line && *line != '\0' ) + add_history(line); +} + +static void +custom_deprep_term_function () +{ +} + +static int +init_readline (int inputfd, int outputfd) +{ + FILE *inputFILE, *outputFILE; + + inputFILE = fdopen (inputfd, "r"); + if (!inputFILE) + return -1; + + outputFILE = fdopen (outputfd, "w"); + if (!outputFILE) + return -1; + + rl_instream = inputFILE; + rl_outstream = outputFILE; + + /* Tell readline what the prompt is if it needs to put it back */ + rl_callback_handler_install("(rltest): ", rlctx_send_user_command); + + /* Set the terminal type to dumb so the output of readline can be + * understood by tgdb */ + if ( rl_reset_terminal("dumb") == -1 ) + return -1; + + /* For some reason, readline can not deprep the terminal. + * However, it doesn't matter because no other application is working on + * the terminal besides readline */ + rl_deprep_term_function = custom_deprep_term_function; + + using_history(); + read_history(".history"); + + return 0; +} + +static int +main_loop(void) +{ + fd_set rset; + int max; + + max = (masterfd > STDIN_FILENO) ? masterfd : STDIN_FILENO; + max = (max > slavefd) ? max : slavefd; + + for (;;) + { + /* Reset the fd_set, and watch for input from GDB or stdin */ + FD_ZERO(&rset); + + FD_SET(STDIN_FILENO, &rset); + FD_SET(slavefd, &rset); + FD_SET(masterfd, &rset); + + /* Wait for input */ + if (select(max + 1, &rset, NULL, NULL, NULL) == -1) + { + if (errno == EINTR) + continue; + else + return -1; + } + + /* Input received through the pty: Handle it + * Wrote to masterfd, slave fd has that input, alert readline to read it. + */ + if (FD_ISSET(slavefd, &rset)) + rl_callback_read_char(); + + /* Input received through the pty. + * Readline read from slavefd, and it wrote to the masterfd. + */ + if (FD_ISSET(masterfd, &rset)) + if ( readline_input() == -1 ) + return -1; + + /* Input received: Handle it, write to masterfd (input to readline) */ + if (FD_ISSET(STDIN_FILENO, &rset)) + if ( user_input() == -1 ) + return -1; + } + + return 0; +} + +/* The terminal attributes before calling tty_cbreak */ +static struct termios save_termios; +static struct winsize size; +static enum { RESET, TCBREAK } ttystate = RESET; + +/* tty_cbreak: Sets terminal to cbreak mode. Also known as noncanonical mode. + * 1. Signal handling is still turned on, so the user can still type those. + * 2. echo is off + * 3. Read in one char at a time. + * + * fd - The file descriptor of the terminal + * + * Returns: 0 on sucess, -1 on error + */ +int tty_cbreak(int fd){ + struct termios buf; + int ttysavefd = -1; + + if(tcgetattr(fd, &save_termios) < 0) + return -1; + + buf = save_termios; + buf.c_lflag &= ~(ECHO | ICANON); + buf.c_iflag &= ~(ICRNL | INLCR); + buf.c_cc[VMIN] = 1; + buf.c_cc[VTIME] = 0; + +#if defined (VLNEXT) && defined (_POSIX_VDISABLE) + buf.c_cc[VLNEXT] = _POSIX_VDISABLE; +#endif + +#if defined (VDSUSP) && defined (_POSIX_VDISABLE) + buf.c_cc[VDSUSP] = _POSIX_VDISABLE; +#endif + + /* enable flow control; only stty start char can restart output */ +#if 0 + buf.c_iflag |= (IXON|IXOFF); +#ifdef IXANY + buf.c_iflag &= ~IXANY; +#endif +#endif + + /* disable flow control; let ^S and ^Q through to pty */ + buf.c_iflag &= ~(IXON|IXOFF); +#ifdef IXANY + buf.c_iflag &= ~IXANY; +#endif + + if(tcsetattr(fd, TCSAFLUSH, &buf) < 0) + return -1; + + ttystate = TCBREAK; + ttysavefd = fd; + + /* set size */ + if(ioctl(fd, TIOCGWINSZ, (char *)&size) < 0) + return -1; + +#ifdef DEBUG + err_msg("%d rows and %d cols\n", size.ws_row, size.ws_col); +#endif + + return (0); +} + +int +tty_off_xon_xoff (int fd) +{ + struct termios buf; + int ttysavefd = -1; + + if(tcgetattr(fd, &buf) < 0) + return -1; + + buf.c_iflag &= ~(IXON|IXOFF); + + if(tcsetattr(fd, TCSAFLUSH, &buf) < 0) + return -1; + + return 0; +} + +/* tty_reset: Sets the terminal attributes back to their previous state. + * PRE: tty_cbreak must have already been called. + * + * fd - The file descrioptor of the terminal to reset. + * + * Returns: 0 on success, -1 on error + */ +int tty_reset(int fd) +{ + if(ttystate != TCBREAK) + return (0); + + if(tcsetattr(fd, TCSAFLUSH, &save_termios) < 0) + return (-1); + + ttystate = RESET; + + return 0; +} + +int +main() +{ + int val; + val = openpty (&masterfd, &slavefd, NULL, NULL, NULL); + if (val == -1) + return -1; + + val = tty_off_xon_xoff (masterfd); + if (val == -1) + return -1; + + val = init_readline (slavefd, slavefd); + if (val == -1) + return -1; + + val = tty_cbreak (STDIN_FILENO); + if (val == -1) + return -1; + + signal (SIGINT, sigint); + + val = main_loop (); + + tty_reset (STDIN_FILENO); + + if (val == -1) + return -1; + + return 0; +} diff --git a/readline/support/config.rpath b/readline/support/config.rpath new file mode 100755 index 0000000..fa24bfc --- /dev/null +++ b/readline/support/config.rpath @@ -0,0 +1,548 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2003 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | pw32* | os2*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux*) + case $CC in + icc|ecc) + wl='-Wl,' + ;; + ccc) + wl='-Wl,' + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + sco3.2v5*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = yes; then + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi4*) + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + hardcode_direct=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10* | hpux11*) + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + sco3.2v5*) + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4.2uw2*) + hardcode_direct=yes + hardcode_minus_L=no + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + ;; + sysv5*) + hardcode_libdir_flag_spec= + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +libname_spec='lib$name' +case "$host_os" in + aix3*) + ;; + aix4* | aix5*) + ;; + amigaos*) + ;; + beos*) + ;; + bsdi4*) + ;; + cygwin* | mingw* | pw32*) + shrext=.dll + ;; + darwin* | rhapsody*) + shrext=.dylib + ;; + dgux*) + ;; + freebsd1*) + ;; + freebsd*) + ;; + gnu*) + ;; + hpux9* | hpux10* | hpux11*) + case "$host_cpu" in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux*) + ;; + netbsd*) + ;; + newsos6) + ;; + nto-qnx) + ;; + openbsd*) + ;; + os2*) + libname_spec='$name' + shrext=.dll + ;; + osf3* | osf4* | osf5*) + ;; + sco3.2v5*) + ;; + solaris*) + ;; + sunos4*) + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + ;; + sysv4*MP*) + ;; + uts4*) + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +case $dirmode in + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: +# mkinstalldirs ends here diff --git a/sim/ChangeLog b/sim/ChangeLog index 83e6dcc..c5b1af0 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,44 @@ +2006-04-08 Hans-Peter Nilsson + + * cris/crisv32f.c (MY (deliver_interrupt)): Set CCS to new_ccs. + +2006-04-03 Hans-Peter Nilsson + + * cris/dv-cris.c, cris/dv-rv.c, cris/rvdummy.c: New files. + * cris/Makefile.in (CONFIG_DEVICES): Remove redundant setting. + (dv-cris.o, dv-rv.o rvdummy$(EXEEXT), rvdummy.o): New rules. + (all): Depend on rvdummy$(EXEEXT). + * cris/configure.ac: Call SIM_AC_OPTION_WARNINGS. Check for + sys/socket.h and sys/select.h. Call SIM_AC_OPTION_HARDWARE, + default off. + * cris/configure: Regenerate. + * cris/cris-sim.h (cris_have_900000xxif): Declare here. + (enum cris_interrupt_type, crisv10deliver_interrupt) + (crisv32deliver_interrupt: New declarations. + * cris/cris-tmpl.c [WITH_HW] (MY (f_model_insn_after)): Call + sim_events_tickn and set state-events member work_pending when it's + time for the next event. + [WITH_HW] (MY (f_specific_init)): Set CPU-model-specific + interrupt-delivery function. + * cris/crisv10f.c (MY (deliver_interrupt)): New function. + * cris/crisv32f.c (MY (deliver_interrupt)): New function. + * cris/devices.c: Include hw-device.h. + (device_io_read_buffer) [WITH_HW]: Call hw_io_read_buffer. + (device_io_write_buffer): Only perform 0x900000xx-functions if + cris_have_900000xxif is nonzero. Else if WITH_HW defined, + call hw_io_write_buffer. Add return 0 last in function. + * cris/sim-if.c (cris_have_900000xxif): Now global. + (sim_open) [WITH_HW]: Clear deliver_interrupt cpu member. + Force "-model" option, effectively. + * cris/sim-main.h (cris_interrupt_delivery_fn): New type. + (struct _sim_cpu) [WITH_HW]: New member deliver_interrupt. + +2006-04-02 Hans-Peter Nilsson + + * cris/Makefile.in (CRISV10F_OBJS): Remove semcrisv10f-switch.o. + (CRISV32F_OBJS): Remove semcrisv32f-switch.o. + (semcrisv10f-switch.o, semcrisv32f-switch.o: Remove dependency rules. + 2006-03-13 DJ Delorie * MAINTAINERS: Add self as m32c sim maintainer. diff --git a/sim/cris/Makefile.in b/sim/cris/Makefile.in index 85af034..e307401 100644 --- a/sim/cris/Makefile.in +++ b/sim/cris/Makefile.in @@ -20,10 +20,9 @@ ## COMMON_PRE_CONFIG_FRAG -CRISV10F_OBJS = crisv10f.o cpuv10.o decodev10.o semcrisv10f-switch.o modelv10.o mloopv10f.o -CRISV32F_OBJS = crisv32f.o cpuv32.o decodev32.o semcrisv32f-switch.o modelv32.o mloopv32f.o +CRISV10F_OBJS = crisv10f.o cpuv10.o decodev10.o modelv10.o mloopv10f.o +CRISV32F_OBJS = crisv32f.o cpuv32.o decodev32.o modelv32.o mloopv32f.o -CONFIG_DEVICES = dv-sockser.o CONFIG_DEVICES = SIM_OBJS = \ @@ -62,11 +61,29 @@ arch = cris sim-if.o: sim-if.c $(SIM_MAIN_DEPS) $(sim-core_h) $(sim-options_h) +# Needs CPU-specific knowledge. +dv-cris.o: dv-cris.c $(SIM_MAIN_DEPS) $(sim-core_h) + +# This is the same rule as dv-core.o etc. +dv-rv.o: dv-rv.c $(hw_main_headers) $(sim_main_headers) + arch.o: arch.c $(SIM_MAIN_DEPS) traps.o: traps.c targ-vals.h $(SIM_MAIN_DEPS) $(sim-options_h) devices.o: devices.c $(SIM_MAIN_DEPS) +# rvdummy is just used for testing. It does nothing if +# --enable-sim-hardware isn't active. + +all: rvdummy$(EXEEXT) + +check: rvdummy$(EXEEXT) + +rvdummy$(EXEEXT): rvdummy.o $(EXTRA_LIBDEPS) + $(CC) $(ALL_CFLAGS) -o rvdummy$(EXEEXT) rvdummy.o $(EXTRA_LIBS) + +rvdummy.o: rvdummy.c config.h tconfig.h $(remote_sim_h) $(callback_h) + # CRISV10 objs CRISV10F_INCLUDE_DEPS = \ @@ -89,7 +106,6 @@ mloopv10f.o: mloopv10f.c semcrisv10f-switch.c $(CRISV10F_INCLUDE_DEPS) cpuv10.o: cpuv10.c $(CRISV10F_INCLUDE_DEPS) decodev10.o: decodev10.c $(CRISV10F_INCLUDE_DEPS) -semcrisv10f-switch.o: semcrisv10f-switch.c $(CRISV10F_INCLUDE_DEPS) modelv10.o: modelv10.c $(CRISV10F_INCLUDE_DEPS) # CRISV32 objs @@ -116,7 +132,6 @@ mloopv32f.o: mloopv32f.c semcrisv32f-switch.c $(CRISV32F_INCLUDE_DEPS) cpuv32.o: cpuv32.c $(CRISV32F_INCLUDE_DEPS) decodev32.o: decodev32.c $(CRISV32F_INCLUDE_DEPS) -semcrisv32f-switch.o: semcrisv32f-switch.c $(CRISV32F_INCLUDE_DEPS) modelv32.o: modelv32.c $(CRISV32F_INCLUDE_DEPS) cris-clean: diff --git a/sim/cris/configure b/sim/cris/configure index 253368c..b15e7dc 100755 --- a/sim/cris/configure +++ b/sim/cris/configure @@ -861,6 +861,9 @@ Optional Features: --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses. --enable-sim-hostendian=end Specify host byte endian orientation. --enable-sim-scache=size Specify simulator execution cache size. + --enable-build-warnings Enable build-time compiler warnings if gcc is used + --enable-gdb-build-warnings Enable SIM specific build-time compiler warnings if gcc is used + --enable-sim-hardware=LIST Specify the hardware to be included in the build. --enable-sim-default-model=model Specify default model to simulate. --enable-sim-environment=environment Specify mixed, user, virtual or operating environment. --enable-sim-inline=inlines Specify which functions should be inlined. @@ -7040,6 +7043,159 @@ sim_link_files="${sim_link_files} ${TARG_VALS_DEF}" sim_link_links="${sim_link_links} targ-vals.def" +# For dv-rv and rvdummy. + + +for ac_header in sys/socket.h sys/select.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + wire_alignment="NONSTRICT_ALIGNMENT" default_alignment="" @@ -7367,6 +7523,180 @@ else fi; +# NOTE: Don't add -Wall or -Wunused, they both include +# -Wunused-parameter which reports bogus warnings. +# NOTE: If you add to this list, remember to update +# gdb/doc/gdbint.texinfo. +build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \ +-Wformat -Wparentheses -Wpointer-arith" +# GCC supports -Wuninitialized only with -O or -On, n != 0. +if test x${CFLAGS+set} = xset; then + case "${CFLAGS}" in + *"-O0"* ) ;; + *"-O"* ) + build_warnings="${build_warnings} -Wuninitialized" + ;; + esac +else + build_warnings="${build_warnings} -Wuninitialized" +fi +# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs +# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value +# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual +# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes +# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls +# -Woverloaded-virtual -Winline -Werror" +# Check whether --enable-build-warnings or --disable-build-warnings was given. +if test "${enable_build_warnings+set}" = set; then + enableval="$enable_build_warnings" + case "${enableval}" in + yes) ;; + no) build_warnings="-w";; + ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` + build_warnings="${build_warnings} ${t}";; + *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` + build_warnings="${t} ${build_warnings}";; + *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; +esac +if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then + echo "Setting compiler warning flags = $build_warnings" 6>&1 +fi +fi; # Check whether --enable-sim-build-warnings or --disable-sim-build-warnings was given. +if test "${enable_sim_build_warnings+set}" = set; then + enableval="$enable_sim_build_warnings" + case "${enableval}" in + yes) ;; + no) build_warnings="-w";; + ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` + build_warnings="${build_warnings} ${t}";; + *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` + build_warnings="${t} ${build_warnings}";; + *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; +esac +if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then + echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 +fi +fi; WARN_CFLAGS="" +WERROR_CFLAGS="" +if test "x${build_warnings}" != x -a "x$GCC" = xyes +then + echo "$as_me:$LINENO: checking compiler warning flags" >&5 +echo $ECHO_N "checking compiler warning flags... $ECHO_C" >&6 + # Separate out the -Werror flag as some files just cannot be + # compiled with it enabled. + for w in ${build_warnings}; do + case $w in + -Werr*) WERROR_CFLAGS=-Werror ;; + *) # Check that GCC accepts it + saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $w" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + WARN_CFLAGS="${WARN_CFLAGS} $w" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$saved_CFLAGS" + esac + done + echo "$as_me:$LINENO: result: ${WARN_CFLAGS}${WERROR_CFLAGS}" >&5 +echo "${ECHO_T}${WARN_CFLAGS}${WERROR_CFLAGS}" >&6 +fi + + +if test x"no" = x"yes"; then + sim_hw_p=yes +else + sim_hw_p=no +fi +if test ""; then + hardware="core pal glue" +else + hardware="core pal glue rv cris" +fi +sim_hw_cflags="-DWITH_HW=1" +sim_hw="$hardware" +sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`" +# Check whether --enable-sim-hardware or --disable-sim-hardware was given. +if test "${enable_sim_hardware+set}" = set; then + enableval="$enable_sim_hardware" + +case "${enableval}" in + yes) sim_hw_p=yes;; + no) sim_hw_p=no;; + ,*) sim_hw_p=yes; hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";; + *,) sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";; + *) sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';; +esac +if test "$sim_hw_p" != yes; then + sim_hw_objs= + sim_hw_cflags="-DWITH_HW=0" + sim_hw= +else + sim_hw_cflags="-DWITH_HW=1" + # remove duplicates + sim_hw="" + sim_hw_objs="\$(SIM_COMMON_HW_OBJS)" + for i in $hardware ; do + case " $sim_hw " in + *" $i "*) ;; + *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";; + esac + done +fi +if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then + echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs" +fi +else + +if test "$sim_hw_p" != yes; then + sim_hw_objs= + sim_hw_cflags="-DWITH_HW=0" + sim_hw= +fi +if test x"$silent" != x"yes"; then + echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs" +fi +fi; + # The default model shouldn't matter as long as there's a BFD. default_sim_default_model="crisv32" diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac index a34a50b..a349d8d 100644 --- a/sim/cris/configure.ac +++ b/sim/cris/configure.ac @@ -9,9 +9,14 @@ sinclude(../common/aclocal.m4) # it by inlining the macro's contents. sinclude(../common/common.m4) +# For dv-rv and rvdummy. +AC_CHECK_HEADERS(sys/socket.h sys/select.h) + SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT) SIM_AC_OPTION_HOSTENDIAN SIM_AC_OPTION_SCACHE(16384) +SIM_AC_OPTION_WARNINGS +SIM_AC_OPTION_HARDWARE(no,,rv cris) # The default model shouldn't matter as long as there's a BFD. SIM_AC_OPTION_DEFAULT_MODEL(crisv32) diff --git a/sim/cris/cris-sim.h b/sim/cris/cris-sim.h index 66f7365..49a6f61 100644 --- a/sim/cris/cris-sim.h +++ b/sim/cris/cris-sim.h @@ -1,5 +1,5 @@ /* Collection of junk for CRIS. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Axis Communications. This file is part of the GNU simulators. @@ -86,6 +86,14 @@ extern USI crisv10f_break_handler (SIM_CPU *, USI, USI); extern USI crisv32f_break_handler (SIM_CPU *, USI, USI); extern USI cris_break_13_handler (SIM_CPU *, USI, USI, USI, USI, USI, USI, USI, USI); +extern char cris_have_900000xxif; +enum cris_interrupt_type { CRIS_INT_NMI, CRIS_INT_RESET, CRIS_INT_INT }; +extern int crisv10deliver_interrupt (SIM_CPU *, + enum cris_interrupt_type, + unsigned int); +extern int crisv32deliver_interrupt (SIM_CPU *, + enum cris_interrupt_type, + unsigned int); /* Using GNU syntax (not C99) so we can compile this on RH 6.2 (egcs-1.1.2/gcc-2.91.66). */ diff --git a/sim/cris/cris-tmpl.c b/sim/cris/cris-tmpl.c index 8994a11..81d1ca2 100644 --- a/sim/cris/cris-tmpl.c +++ b/sim/cris/cris-tmpl.c @@ -178,6 +178,18 @@ MY (f_model_insn_after) (SIM_CPU *current_cpu, int last_p ATTRIBUTE_UNUSED, PROFILE_MODEL_TOTAL_CYCLES (p) += cycles; CPU_CRIS_MISC_PROFILE (current_cpu)->basic_cycle_count += cycles; PROFILE_MODEL_CUR_INSN_CYCLES (p) = cycles; + +#if WITH_HW + /* For some reason, we don't get to the sim_events_tick call in + cgen-run.c:engine_run_1. Besides, more than one cycle has + passed, so we want sim_events_tickn anyway. The "events we want + to process" is usually to initiate an interrupt, but might also + be other events. We can't do the former until the main loop is + at point where it accepts changing the PC without internal + inconsistency, so just set a flag and wait. */ + if (sim_events_tickn (CPU_STATE (current_cpu), cycles)) + STATE_EVENTS (CPU_STATE (current_cpu))->work_pending = 1; +#endif } /* Initialize cycle counting for an insn. @@ -245,6 +257,9 @@ MY (f_specific_init) (SIM_CPU *current_cpu) { current_cpu->make_thread_cpu_data = MY (make_thread_cpu_data); current_cpu->thread_cpu_data_size = sizeof (current_cpu->cpu_data); +#if WITH_HW + current_cpu->deliver_interrupt = MY (deliver_interrupt); +#endif } /* Model function for arbitrary single stall cycles. */ diff --git a/sim/cris/crisv10f.c b/sim/cris/crisv10f.c index 0c2a17c..976badb 100644 --- a/sim/cris/crisv10f.c +++ b/sim/cris/crisv10f.c @@ -1,5 +1,5 @@ /* CRIS v10 simulator support code - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Axis Communications. This file is part of the GNU simulators. @@ -40,3 +40,62 @@ MY (XCONCAT3 (f_model_crisv,BASENUM, } #endif /* WITH_PROFILE_MODEL_P */ + +/* Do the interrupt sequence if possible, and return 1. If interrupts + are disabled or some other lockout is active, return 0 and do + nothing. + + Beware, the v10 implementation is incomplete and doesn't properly + lock out interrupts e.g. after special-register access and doesn't + handle user-mode. */ + +int +MY (deliver_interrupt) (SIM_CPU *current_cpu, + enum cris_interrupt_type type, + unsigned int vec) +{ + unsigned char entryaddr_le[4]; + int was_user; + SIM_DESC sd = CPU_STATE (current_cpu); + unsigned32 entryaddr; + + /* We haven't implemented other interrupt-types yet. */ + if (type != CRIS_INT_INT) + abort (); + + /* We're supposed to be called outside of prefixes and branch + delay-slots etc, but why not check. */ + if (GET_H_INSN_PREFIXED_P ()) + abort (); + + if (!GET_H_IBIT ()) + return 0; + + /* User mode isn't supported for interrupts. (And we shouldn't see + this as 1 anyway. The user-mode bit isn't visible from user + mode. It doesn't make it into the U bit until the next + interrupt/exception.) */ + if (GET_H_UBIT ()) + abort (); + + SET_H_PBIT (1); + + if (sim_core_read_buffer (sd, + current_cpu, + read_map, entryaddr_le, + GET_H_SR (H_SR_PRE_V32_IBR) + vec * 4, 4) == 0) + { + /* Nothing to do actually; either abort or send a signal. */ + sim_core_signal (sd, current_cpu, CIA_GET (current_cpu), 0, 4, + GET_H_SR (H_SR_PRE_V32_IBR) + vec * 4, + read_transfer, sim_core_unmapped_signal); + return 0; + } + + entryaddr = bfd_getl32 (entryaddr_le); + + SET_H_SR (H_SR_PRE_V32_IRP, GET_H_PC ()); + SET_H_PC (entryaddr); + + return 1; +} diff --git a/sim/cris/crisv32f.c b/sim/cris/crisv32f.c index d1d5fc9..ad8297e 100644 --- a/sim/cris/crisv32f.c +++ b/sim/cris/crisv32f.c @@ -1,5 +1,5 @@ /* CRIS v32 simulator support code - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Axis Communications. This file is part of the GNU simulators. @@ -556,3 +556,73 @@ MY (XCONCAT3 (f_model_crisv,BASENUM, } #endif /* WITH_PROFILE_MODEL_P */ + +int +MY (deliver_interrupt) (SIM_CPU *current_cpu, + enum cris_interrupt_type type, + unsigned int vec) +{ + unsigned32 old_ccs, shifted_ccs, new_ccs; + unsigned char entryaddr_le[4]; + int was_user; + SIM_DESC sd = CPU_STATE (current_cpu); + unsigned32 entryaddr; + + /* We haven't implemented other interrupt-types yet. */ + if (type != CRIS_INT_INT) + abort (); + + /* We're called outside of branch delay slots etc, so we don't check + for that. */ + if (!GET_H_IBIT_V32 ()) + return 0; + + old_ccs = GET_H_SR_V32 (H_SR_CCS); + shifted_ccs = (old_ccs << 10) & ((1 << 30) - 1); + + /* The M bit is handled by code below and the M bit setter function, but + we need to preserve the Q bit. */ + new_ccs = shifted_ccs | (old_ccs & (unsigned32) 0x80000000UL); + was_user = GET_H_UBIT_V32 (); + + /* We need to force kernel mode since the setter method doesn't allow + it. Then we can use setter methods at will, since they then + recognize that we're in kernel mode. */ + CPU (h_ubit_v32) = 0; + + SET_H_SR (H_SR_CCS, new_ccs); + + if (was_user) + { + /* These methods require that user mode is unset. */ + SET_H_SR (H_SR_USP, GET_H_GR (H_GR_SP)); + SET_H_GR (H_GR_SP, GET_H_KERNEL_SP ()); + } + + /* ERP setting is simplified by not taking interrupts in delay-slots + or when halting. */ + /* For all other exceptions than guru and NMI, store the return + address in ERP and set EXS and EXD here. */ + SET_H_SR (H_SR_ERP, GET_H_PC ()); + + /* Simplified by not having exception types (fault indications). */ + SET_H_SR_V32 (H_SR_EXS, (vec * 256)); + SET_H_SR_V32 (H_SR_EDA, 0); + + if (sim_core_read_buffer (sd, + current_cpu, + read_map, entryaddr_le, + GET_H_SR (H_SR_EBP) + vec * 4, 4) == 0) + { + /* Nothing to do actually; either abort or send a signal. */ + sim_core_signal (sd, current_cpu, CIA_GET (current_cpu), 0, 4, + GET_H_SR (H_SR_EBP) + vec * 4, + read_transfer, sim_core_unmapped_signal); + return 0; + } + + entryaddr = bfd_getl32 (entryaddr_le); + SET_H_PC (entryaddr); + + return 1; +} diff --git a/sim/cris/devices.c b/sim/cris/devices.c index feb901a..e694ff3 100644 --- a/sim/cris/devices.c +++ b/sim/cris/devices.c @@ -1,5 +1,5 @@ /* CRIS device support - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Axis Communications. This file is part of the GNU simulators. @@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "dv-sockser.h" #endif +#include "hw-device.h" + /* Placeholder definition. */ struct _device { char dummy; } cris_devices; @@ -48,7 +50,11 @@ device_io_read_buffer (device *me ATTRIBUTE_UNUSED, SIM_CPU *cpu ATTRIBUTE_UNUSED, sim_cia cia ATTRIBUTE_UNUSED) { +#if WITH_HW + return hw_io_read_buffer ((struct hw *) me, source, space, addr, nr_bytes); +#else abort (); +#endif } int @@ -61,13 +67,22 @@ device_io_write_buffer (device *me ATTRIBUTE_UNUSED, static const unsigned char ok[] = { 4, 0, 0, 0x90}; static const unsigned char bad[] = { 8, 0, 0, 0x90}; - if (addr == 0x90000004 && memcmp (source, ok, sizeof ok) == 0) - cris_break_13_handler (cpu, 1, 0, 0, 0, 0, 0, 0, cia); - else if (addr == 0x90000008 - && memcmp (source, bad, sizeof bad) == 0) - cris_break_13_handler (cpu, 1, 34, 0, 0, 0, 0, 0, cia); + if (cris_have_900000xxif) + { + if (addr == 0x90000004 && memcmp (source, ok, sizeof ok) == 0) + return cris_break_13_handler (cpu, 1, 0, 0, 0, 0, 0, 0, cia); + else if (addr == 0x90000008 + && memcmp (source, bad, sizeof bad) == 0) + return cris_break_13_handler (cpu, 1, 34, 0, 0, 0, 0, 0, cia); + } +#if WITH_HW + else + return hw_io_write_buffer ((struct hw *) me, source, space, addr, nr_bytes); +#endif /* If it wasn't one of those, send an invalid-memory signal. */ sim_core_signal (sd, cpu, cia, 0, nr_bytes, addr, write_transfer, sim_core_unmapped_signal); + + return 0; } diff --git a/sim/cris/dv-cris.c b/sim/cris/dv-cris.c new file mode 100644 index 0000000..b98a6b7 --- /dev/null +++ b/sim/cris/dv-cris.c @@ -0,0 +1,314 @@ +/* The CRIS interrupt framework for GDB, the GNU Debugger. + + Copyright 2006 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "sim-main.h" +#include "hw-main.h" + +/* DEVICE + + CRIS cpu virtual device (very rudimental; generic enough for all + currently used CRIS versions). + + + DESCRIPTION + + Implements the external CRIS functionality. This includes the + delivery of interrupts generated from other devices. + + + PROPERTIES + + vec-for-int = ... + These are the translations to interrupt vector for values appearing + on the "int" port, as pairs of the value and the corresponding + vector. Defaults to no translation. All values that may appear on + the "int" port must be defined, or the device aborts. + + multiple-int = ("abort" | "ignore_previous" | ) + If multiple interrupt values are dispatched, this property decides + what to do. The value is either a number corresponding to the + vector to use, or the string "abort" to cause a hard abort, or the + string "ignore_previous", to silently use the new vector instead. + The default is "abort". + + + PORTS + + int (input) + Interrupt port. An event with a non-zero value on this port causes + an interrupt. If, after an event but before the interrupt has been + properly dispatched, a non-zero value appears that is different + after mapping than the previous, then the property multiple_int + decides what to do. + + FIXME: reg port so internal registers can be read. Requires + chip-specific versions, though. Ports "nmi" and "reset". + + + BUGS + When delivering an interrupt, this code assumes that there is only + one processor (number 0). + + This code does not attempt to be efficient at handling pending + interrupts. It simply schedules the interrupt delivery handler + every instruction cycle until all pending interrupts go away. + It also works around a bug in sim_events_process when doing so. + */ + +/* Keep this an enum for simple addition of "reset" and "nmi". */ +enum + { + INT_PORT, + }; + +static const struct hw_port_descriptor cris_ports[] = + { + { "int", INT_PORT, 0, input_port }, + { NULL, 0, 0, 0 } + }; + +struct cris_vec_tr + { + unsigned32 portval, vec; + }; + +enum cris_multiple_ints + { + cris_multint_abort, + cris_multint_ignore_previous, + cris_multint_vector + }; + +struct cris_hw + { + struct hw_event *pending_handler; + unsigned32 pending_vector; + struct cris_vec_tr *int_to_vec; + enum cris_multiple_ints multi_int_action; + unsigned32 multiple_int_vector; + }; + +/* An event function, calling the actual CPU-model-specific + interrupt-delivery function. */ + +static void +deliver_cris_interrupt (struct hw *me, void *data) +{ + struct cris_hw *crishw = hw_data (me); + SIM_DESC simulator = hw_system (me); + sim_cpu *cpu = STATE_CPU (simulator, 0); + unsigned int intno = crishw->pending_vector; + + if (CPU_CRIS_DELIVER_INTERRUPT (cpu) (cpu, CRIS_INT_INT, intno)) + { + crishw->pending_vector = 0; + crishw->pending_handler = NULL; + return; + } + + { + /* Bug workaround: at time T with a pending number of cycles N to + process, if re-scheduling an event at time T+M, M < N, + sim_events_process gets stuck at T (updating the "time" to + before the event rather than after the event, or somesuch). + + Hacking this locally is thankfully easy: if we see the same + simulation time, increase the number of cycles. Do this every + time we get here, until a new time is seen (supposedly unstuck + re-delivery). (Fixing in SIM/GDB source will hopefully then + also be easier, having a tangible test-case.) */ + static signed64 last_events_time = 0; + static signed64 delta = 1; + signed64 this_events_time = hw_event_queue_time (me); + + if (this_events_time == last_events_time) + delta++; + else + { + delta = 1; + last_events_time = this_events_time; + } + + crishw->pending_handler + = hw_event_queue_schedule (me, delta, deliver_cris_interrupt, NULL); + } +} + + +/* A port-event function for events arriving to an interrupt port. */ + +static void +cris_port_event (struct hw *me, + int my_port, + struct hw *source, + int source_port, + int intparam) +{ + struct cris_hw *crishw = hw_data (me); + unsigned32 vec; + + /* A few placeholders; only the INT port is implemented. */ + switch (my_port) + { + case INT_PORT: + HW_TRACE ((me, "INT value=0x%x", intparam)); + break; + + default: + hw_abort (me, "bad switch"); + break; + } + + if (intparam == 0) + return; + + if (crishw->int_to_vec != NULL) + { + unsigned int i; + for (i = 0; crishw->int_to_vec[i].portval != 0; i++) + if (crishw->int_to_vec[i].portval == intparam) + break; + + if (crishw->int_to_vec[i].portval == 0) + hw_abort (me, "unsupported value for int port: 0x%x", intparam); + + vec = crishw->int_to_vec[i].vec; + } + else + vec = (unsigned32) intparam; + + if (crishw->pending_vector != 0) + { + if (vec == crishw->pending_vector) + return; + + switch (crishw->multi_int_action) + { + case cris_multint_abort: + hw_abort (me, "int 0x%x (0x%x) while int 0x%x hasn't been delivered", + vec, intparam, crishw->pending_vector); + break; + + case cris_multint_ignore_previous: + break; + + case cris_multint_vector: + vec = crishw->multiple_int_vector; + break; + + default: + hw_abort (me, "bad switch"); + } + } + + crishw->pending_vector = vec; + + /* Schedule our event handler *now*. */ + if (crishw->pending_handler == NULL) + crishw->pending_handler + = hw_event_queue_schedule (me, 0, deliver_cris_interrupt, NULL); +} + +/* Instance initializer function. */ + +static void +cris_finish (struct hw *me) +{ + struct cris_hw *crishw; + const struct hw_property *vec_for_int; + const struct hw_property *multiple_int; + + crishw = HW_ZALLOC (me, struct cris_hw); + set_hw_data (me, crishw); + set_hw_ports (me, cris_ports); + set_hw_port_event (me, cris_port_event); + + vec_for_int = hw_find_property (me, "vec-for-int"); + if (vec_for_int != NULL) + { + unsigned32 vecsize; + unsigned32 i; + + if (hw_property_type (vec_for_int) != array_property) + hw_abort (me, "property \"vec-for-int\" has the wrong type"); + + vecsize = hw_property_sizeof_array (vec_for_int) / sizeof (signed_cell); + + if ((vecsize % 2) != 0) + hw_abort (me, "translation vector does not consist of even pairs"); + + crishw->int_to_vec + = hw_malloc (me, (vecsize/2 + 1) * sizeof (crishw->int_to_vec[0])); + + for (i = 0; i < vecsize/2; i++) + { + signed_cell portval_sc; + signed_cell vec_sc; + + if (!hw_find_integer_array_property (me, "vec-for-int", i*2, + &portval_sc) + || !hw_find_integer_array_property (me, "vec-for-int", i*2 + 1, + &vec_sc) + || portval_sc < 0 + || vec_sc < 0) + hw_abort (me, "no valid vector translation pair %u", i); + + crishw->int_to_vec[i].portval = (unsigned32) portval_sc; + crishw->int_to_vec[i].vec = (unsigned32) vec_sc; + } + + crishw->int_to_vec[i].portval = 0; + crishw->int_to_vec[i].vec = 0; + } + + multiple_int = hw_find_property (me, "multiple-int"); + if (multiple_int != NULL) + { + if (hw_property_type (multiple_int) == integer_property) + { + crishw->multiple_int_vector + = hw_find_integer_property (me, "multiple-int"); + crishw->multi_int_action = cris_multint_vector; + } + else + { + const char *action = hw_find_string_property (me, "multiple-int"); + + if (action == NULL) + hw_abort (me, "property \"multiple-int\" has the wrong type"); + + if (strcmp (action, "abort") == 0) + crishw->multi_int_action = cris_multint_abort; + else if (strcmp (action, "ignore_previous") == 0) + crishw->multi_int_action = cris_multint_ignore_previous; + else + hw_abort (me, "property \"multiple-int\" must be one of \n" + "\"abort\" and \"ignore_previous\", not \"%s\"", action); + } + } + else + crishw->multi_int_action = cris_multint_abort; +} + +const struct hw_descriptor dv_cris_descriptor[] = { + { "cris", cris_finish, }, + { NULL }, +}; diff --git a/sim/cris/dv-rv.c b/sim/cris/dv-rv.c new file mode 100644 index 0000000..30845e3 --- /dev/null +++ b/sim/cris/dv-rv.c @@ -0,0 +1,1221 @@ +/* The remote-virtual-component simulator framework + for GDB, the GNU Debugger. + + Copyright 2006 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + +#include "sim-main.h" +#include "hw-main.h" + +#include "hw-tree.h" + +#include + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +/* Not guarded in dv-sockser.c, so why here. */ +#include +#include +#include +#include + + +/* DEVICE + + + rv - Remote Virtual component + + + DESCRIPTION + + + Socket connection to a remote simulator component, for example one + for testing a verilog construction. Protocol defined below. + + There is a set of 32-bit I/O ports, with a mapping from local to + remote addresses. There is a set of interrupts expressed as a + bit-mask, with a mapping from remote to local. There is a set of + memory ranges (actual memory defined elsewhere), also with a + mapping from remote to local addresses, that is expected to be + accessible to the remote simulator in 32-byte chunks (simulating + DMA). There is a mapping from remote cycles (or an appropriate + elsewhere defined time-slice) to local cycles. + + PROPERTIES + + reg =
+ The address (within the parent bus) that this device is to + be located. + + remote-reg = + The address of reg on the remote side. Defaults to 0. + + mem =
+ Specify an address-range (within the parent bus) that the remote + device can access. The memory is assumed to be already defined. + If there's no memory defined but the remote side asks for a memory + access, the simulation is aborted. + + remote-mem = + The address of mem on the remote side. Defaults to 0. + + mbox =
+ Address of the mailbox interface. Writes to this address with the + local address of a mailbox command, a complete packet with length + and command; (4 or 6)) invokes the mailbox interface. Reads are + invalid. Replies are written to the same address. Address space + from
up-to-and-including
+3 is allocated. + + max-poll-ticks = + Sets the maximum interval between polling the external component, + expressed in internal cycles. Defaults to 10000. + + watchdog-interval = + Sets the wallclock seconds between watchdog packets sent to the + remote side (may be larger if there's no rv activity in that time). + Defaults to 30. If set to 0, no watchdog packets are sent. + + intnum = ... + Defines a map from remote bit numbers to local values to be emitted + on the "int" port, with the external bit number as the ordinal - 1 + of the local translation. E.g. 43 121 would mean map external + (1<<0) to internal 43 and external (1<<1) to internal 121. The + default is unity; no translation. If more than one bit is set in + the remote interrupt word, the intmultiple property can be used to + control the translation. + + intmultiple = + When more than one bit is set in the remote interrupt word, you may + want to map this situation to a separate interrupt value. If this + property is non-zero, it is used as that value. If it is zero, the + local value for the "int" port is the bitwise-or of the translated + local values. + + host = + The hostname or address where the simulator to be used listens. + Defaults to "127.0.0.1" + + port = + The hostname or address where the simulator to be used listens. + Defaults to 10000. + + dummy = + or + dummy = + Don't connect to a remote side; use initial dummy contents from + (which has to be at least as big as the argument + of reg above) or filled with byte-value . Mailboxes are not + supported (can be defined but can not be used) and remote-memory + accesses don't apply. The main purpose for this property is to + simplify use of configuration and simulated hardware that is + e.g. only trivially initialized but not actually used. + + + PORTS + + int (output) + Driven as a result of a remote interrupt request. The value is a + 32-bit bitset of active interrupts. + + + BUGS + + All and none. + + + PROTOCOL + + This is version 1.0 of this protocol, defining packet format and + actions in a supposedly upward-compatible manner where client and + servers of different versions are expected to interoperate; the + format and the definitions below are hopefully generic enough to + allow this. + + Each connection has a server and a client (this code); the roles + are known beforehand. The client usually corresponds to a CPU and + memory system and the server corresponds to a memory-mapped + register hardware interface and/or a DMA controller. They + communicate using packets with specific commands, of which some + require replies from the other side; most are intiated by the + client with one exception. A reply uses the same format as the + command. + + Packets are at least three bytes long, where the first two bytes + form a header, a 16-bit little-endian number that is the total + length of the packet including the header. There is also a + one-byte command. The payload is optional, depending on the + command. + + [[16-bit-low-byte-of-length] [16-bit-high-byte-of-length] + [command/reply] [payload byte 0] [payload byte 1] + ... [payload byte (length-of-packet - 3)]] + + Commands: + + A client or server that reads an undocumented command may exit with + a hard error. Payload not defined or disallowed below is ignored. + + It is expected that future client versions find out the version of + the server side by polling with base commands, assuming earlier + versions if a certain reply isn't seen, with newly defined payload + parts where earlier versions left it undefined. New commands and + formats are sent only to the other side after the client and server + has found out each others version. Not all servers support all + commands; the type of server and supported set of commands is + expected to be known beforehand. + + RV_READ_CMD = 0 + Initiated by the client, requires a reply from the server. The + payload from the client is at least 4 bytes, forming a 4-byte + little-endian address, the rest being undefined. The reply from + the server is at least 8 bytes, forming the same address data as in + the request and the second 4-byte data being the little-endian + contents. + + RV_WRITE_CMD = 1 + Initiated by the client, requires a reply from the server. Payload + from the client is at least 8 bytes, forming a 4-byte little-endian + word being the address, the rest being the little-endian contents + to write. The reply from the server is 8 bytes unless elsewhere + agreed otherwise, forming the same address and data as in the + request. The data sent back may have been altered to correspond to + defined parts but can safely be discarded. + + RV_IRQ_CMD = 2 + Initiated by the server, no reply. The payload is 4 bytes, forming + a little-endian word with bits numbers corresponding to currently + active interrupt sources; value (1<fd < 0) + hw_abort (me, "couldn't open a connection to %s:%d because: %s", + rv->host, rv->port, strerror (rv->saved_errno)); + + while (len > 0) + { + ssize_t ret = write (rv->fd, bufp, len); + if (ret < 0) + /* FIXME: More graceful exit. */ + hw_abort (me, "write to %s:%d failed: %s\n", rv->host, rv->port, + strerror (errno)); + + len -= ret; + bufp += ret; + } +} + +/* Read LEN bytes of data into BUF from the socket. Set the file + descriptor to -1 if there's an error. */ + +static void +hw_rv_read (struct hw *me, + void *buf, + unsigned int len) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + unsigned8 *bufp = buf; + + while (len > 0) + { + ssize_t ret = read (rv->fd, bufp, len); + + /* We get all zero if the remote end quits, but no error + indication; even select says there's data active. */ + if (ret <= 0) + { + if (close (rv->fd) != 0) + /* FIXME: More graceful exit. */ + hw_abort (me, "read from %s:%d failed: %d\n", rv->host, rv->port, errno); + rv->fd = -1; + return; + } + + len -= ret; + bufp += ret; + } +} + +/* Construct and send a packet of data of type CMD and len + LEN_NOHEADER (not counting the header...). */ + +static void +hw_rv_send (struct hw *me, + unsigned int cmd, + void *msg, + unsigned int len_noheader) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + unsigned8 buf[32+3]; + unsigned8 *bufp; + unsigned int len = len_noheader + 3; + int ret; + + buf[0] = len & 255; + buf[1] = (len >> 8) & 255; + buf[2] = cmd; + + if (len > sizeof (buf)) + { + hw_rv_write (me, buf, 3); + len = len_noheader; + bufp = msg; + } + else + { + memcpy (buf + 3, msg, len_noheader); + bufp = buf; + } + + hw_rv_write (me, bufp, len); +} + +/* Handle incoming DMA requests as per the RV_MEM_RD_CMD packet. + Abort on errors. */ + +static void +hw_rv_read_mem (struct hw *me, unsigned int len) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + /* If you change this size, please adjust the mem2 testcase. */ + unsigned8 buf[32+8]; + unsigned8 *bufp = buf; + unsigned32 leaddr; + unsigned32 addr; + unsigned32 lelen; + unsigned32 i; + + if (len != 8) + hw_abort (me, "expected DMA read request len 8+3, got %d+3", len); + + hw_rv_read (me, &leaddr, 4); + hw_rv_read (me, &lelen, 4); + len = LE2H_4 (lelen); + addr = LE2H_4 (leaddr); + + if (addr < rv->remote_mem_address + || addr >= rv->remote_mem_address + rv->mem_size) + hw_abort (me, "DMA read at remote 0x%x; outside [0x%x..0x%x-1]", + (unsigned) addr, (unsigned) rv->remote_mem_address, + (unsigned) (rv->remote_mem_address + rv->mem_size)); + addr = addr - rv->remote_mem_address + rv->mem_address; + + if (len == 0) + hw_abort (me, "DMA read request for 0 bytes isn't supported"); + + if (len & ~rv->mem_burst_mask) + hw_abort (me, "DMA trying to read %d bytes; not matching mask of 0x%x", + len, rv->mem_burst_mask); + if (len + 8 > sizeof (buf)) + bufp = hw_malloc (me, len + 8); + + HW_TRACE ((me, "DMA R 0x%x..0x%x", addr, addr + len -1)); + hw_dma_read_buffer (me, bufp + 8, 0, addr, len); + if (hw_trace_p (me)) + for (i = 0; i < len; i += 4) + HW_TRACE ((me, "0x%x: %02x %02x %02x %02x", + addr + i, + bufp[i+8], bufp[i+9], bufp[i+10], bufp[i+11])); + + memcpy (bufp, &leaddr, 4); + memcpy (bufp + 4, &lelen, 4); + hw_rv_send (me, RV_MEM_RD_CMD, bufp, len + 8); + if (bufp != buf) + hw_free (me, bufp); +} + +/* Handle incoming DMA requests as per the RV_MEM_WR_CMD packet. + Abort on errors. */ + +static void +hw_rv_write_mem (struct hw *me, unsigned int plen) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + /* If you change this size, please adjust the mem2 testcase. */ + unsigned8 buf[32+8]; + unsigned8 *bufp = buf; + unsigned32 leaddr; + unsigned32 addr; + unsigned32 lelen; + unsigned32 len; + unsigned32 i; + + hw_rv_read (me, &leaddr, 4); + hw_rv_read (me, &lelen, 4); + len = LE2H_4 (lelen); + addr = LE2H_4 (leaddr); + + if (len != plen - 8) + hw_abort (me, + "inconsistency in DMA write request packet: " + "envelope %d+3, inner %d bytes", plen, len); + + if (addr < rv->remote_mem_address + || addr >= rv->remote_mem_address + rv->mem_size) + hw_abort (me, "DMA write at remote 0x%x; outside [0x%x..0x%x-1]", + (unsigned) addr, (unsigned) rv->remote_mem_address, + (unsigned) (rv->remote_mem_address + rv->mem_size)); + + addr = addr - rv->remote_mem_address + rv->mem_address; + if (len == 0) + hw_abort (me, "DMA write request for 0 bytes isn't supported"); + + if (len & ~rv->mem_burst_mask) + hw_abort (me, "DMA trying to write %d bytes; not matching mask of 0x%x", + len, rv->mem_burst_mask); + if (len + 8 > sizeof (buf)) + bufp = hw_malloc (me, len + 8); + + hw_rv_read (me, bufp + 8, len); + HW_TRACE ((me, "DMA W 0x%x..0x%x", addr, addr + len - 1)); + hw_dma_write_buffer (me, bufp + 8, 0, addr, len, 0); + if (hw_trace_p (me)) + for (i = 0; i < len; i += 4) + HW_TRACE ((me, "0x%x: %02x %02x %02x %02x", + addr + i, + bufp[i+8], bufp[i+9], bufp[i+10], bufp[i+11])); + if (bufp != buf) + hw_free (me, bufp); +} + +static void +hw_rv_irq (struct hw *me, unsigned int len) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + unsigned32 intbitsle; + unsigned32 intbits_ext; + unsigned32 intval = 0; + int i; + + if (len != 4) + hw_abort (me, "IRQ with %d data not supported", len); + + hw_rv_read (me, &intbitsle, 4); + intbits_ext = LE2H_4 (intbitsle); + for (i = 0; i < 32; i++) + if ((intbits_ext & (1 << i)) != 0) + intval |= rv->remote_to_local_int[i]; + if ((intbits_ext & ~(intbits_ext - 1)) != intbits_ext + && rv->intmultiple != 0) + intval = rv->intmultiple; + + HW_TRACE ((me, "IRQ 0x%x", intval)); + hw_port_event (me, INT_PORT, intval); +} + +/* Handle incoming interrupt notifications as per the RV_IRQ_CMD + packet. Abort on errors. */ + +static void +hw_rv_handle_incoming (struct hw *me, + int expected_type, + unsigned8 *buf, + unsigned int *return_len) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + unsigned8 cbuf[32]; + unsigned int len; + unsigned int cmd; + + while (1) + { + hw_rv_read (me, cbuf, 3); + + if (rv->fd < 0) + return; + + len = cbuf[0] + cbuf[1] * 256 - 3; + cmd = cbuf[2]; + + /* These come in "asynchronously"; not as a reply. */ + switch (cmd) + { + case RV_IRQ_CMD: + hw_rv_irq (me, len); + break; + + case RV_MEM_RD_CMD: + hw_rv_read_mem (me, len); + break; + + case RV_MEM_WR_CMD: + hw_rv_write_mem (me, len); + break; + } + + /* Something is incoming from the other side, so tighten up all + slack at the next wait. */ + rv->next_period = 1; + + switch (cmd) + { + case RV_MEM_RD_CMD: + case RV_MEM_WR_CMD: + case RV_IRQ_CMD: + /* Don't try to handle more than one of these if we were'nt + expecting a reply. */ + if (expected_type == -1) + return; + continue; + } + + /* Require a match between this supposed-reply and the command + for the rest. */ + if (cmd != expected_type) + hw_abort (me, "unexpected reply, expected command %d, got %d", + expected_type, cmd); + + switch (cmd) + { + case RV_MBOX_PUT_CMD: + case RV_MBOX_HANDLE_CMD: + case RV_WRITE_CMD: + case RV_READ_CMD: + hw_rv_read (me, buf, len <= *return_len ? len : *return_len); + *return_len = len; + break; + } + break; + } +} + +/* Send a watchdog packet. Make a note of wallclock time. */ + +static void +hw_rv_send_wdog (struct hw *me) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + HW_TRACE ((me, "WD")); + gettimeofday (&rv->last_wdog_time, NULL); + hw_rv_send (me, RV_WATCHDOG_CMD, "", 0); +} + +/* Poll the remote side: see if there's any incoming traffic; handle a + packet if so. Send a watchdog packet if it's time to do so. + Beware that the Linux select call indicates traffic for a socket + that the remote side has closed (which may be because it was + finished; don't hork until we need to write something just because + we're polling). */ + +static void +hw_rv_poll_once (struct hw *me) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + fd_set rfds; + fd_set efds; + struct timeval now; + int ret; + struct timeval tv; + + if (rv->fd < 0) + /* Connection has died or was never initiated. */ + return; + + FD_ZERO (&rfds); + FD_SET (rv->fd, &rfds); + FD_ZERO (&efds); + FD_SET (rv->fd, &efds); + tv.tv_sec = 0; + tv.tv_usec = 0; + + ret = select (rv->fd + 1, &rfds, NULL, &efds, &tv); + gettimeofday (&now, NULL); + + if (ret < 0) + hw_abort (me, "select failed: %d\n", errno); + + if (rv->watchdog_interval != 0 + && now.tv_sec - rv->last_wdog_time.tv_sec >= rv->watchdog_interval) + hw_rv_send_wdog (me); + + if (FD_ISSET (rv->fd, &rfds)) + hw_rv_handle_incoming (me, -1, NULL, NULL); +} + +/* Initialize mapping of remote-to-local interrupt data. */ + +static void +hw_rv_map_ints (struct hw *me) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + int i; + + for (i = 0; i < 32; i++) + rv->remote_to_local_int[i] = 1 << i; + + if (hw_find_property (me, "intnum") != NULL) + for (i = 0; i < 32; i++) + { + signed_cell val = -1; + if (hw_find_integer_array_property (me, "intnum", i, &val) > 0) + { + if (val > 0) + rv->remote_to_local_int[i] = val; + else + hw_abort (me, "property \"intnum@%d\" must be > 0; is %d", + i, (int) val); + } + } +} + +/* Handle the after-N-ticks "poll event", calling the poll-the-fd + method. Update the period. */ + +static void +do_poll_event (struct hw *me, void *data) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + unsigned32 new_period; + + if (rv->dummy != NULL) + return; + + hw_rv_poll_once (me); + if (rv->fd >= 0) + rv->poll_callback + = hw_event_queue_schedule (me, rv->next_period, do_poll_event, NULL); + + new_period = rv->next_period * 2; + if (new_period <= rv->max_tick_poll_interval) + rv->next_period = new_period; +} + +/* HW tree traverse function for hw_rv_add_init. */ + +static void +hw_rv_add_poller (struct hw *me, void *data) +{ + hw_rv_device *rv; + + if (hw_family (me) == NULL + || strcmp (hw_family (me), RV_FAMILY_NAME) != 0) + return; + + rv = (hw_rv_device *) hw_data (me); + if (rv->poll_callback != NULL) + return; + + rv->poll_callback + = hw_event_queue_schedule (me, 1, do_poll_event, NULL); +} + +/* Simulator module init function for hw_rv_add_init. */ + +/* FIXME: For the call so hw_tree_traverse, we need to know that the + first member of struct sim_hw is the struct hw *root, but there's + no accessor method and struct sim_hw is defined in sim-hw.c only. + Hence this hack, until an accessor is added, or there's a traverse + function that takes a SIM_DESC argument. */ +struct sim_hw { struct hw *tree; }; + +static SIM_RC +hw_rv_add_rv_pollers (SIM_DESC sd) +{ + hw_tree_traverse (STATE_HW (sd)->tree, hw_rv_add_poller, NULL, NULL); + return SIM_RC_OK; +} + +/* We need to add events for polling, but we can't add one from the + finish-function, and there are no other call points, at least for + instances without "reg" (when there are just DMA requests from the + remote end; no locally initiated activity). Therefore we add a + simulator module init function, but those don't have private + payload arguments; just a SD argument. We cope by parsing the HW + root and making sure *all* "rv":s have poll callbacks installed. + Luckily, this is just an initialization step, and not many + simultaneous instances of rv are expected: we get a N**2 complexity + for visits to each rv node by this method. */ + +static void +hw_rv_add_init (struct hw *me) +{ + sim_module_add_init_fn (hw_system (me), hw_rv_add_rv_pollers); +} + +/* Open up a connection to the other side. Abort on errors. */ + +static void +hw_rv_init_socket (struct hw *me) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + int sock; + struct sockaddr_in server; + + rv->fd = -1; + + if (rv->dummy != NULL) + return; + + memset (&server, 0, sizeof (server)); + server.sin_family = AF_INET; + server.sin_addr.s_addr = inet_addr (rv->host); + + /* Solaris 2.7 lacks this macro. */ +#ifndef INADDR_NONE +#define INADDR_NONE -1 +#endif + + if (server.sin_addr.s_addr == INADDR_NONE) + { + struct hostent *h; + h = gethostbyname (rv->host); + if (h != NULL) + { + memcpy (&server.sin_addr, h->h_addr, h->h_length); + server.sin_family = h->h_addrtype; + } + else + hw_abort (me, "can't resolve host %s", rv->host); + } + + server.sin_port = htons (rv->port); + sock = socket (AF_INET, SOCK_STREAM, 0); + + if (sock < 0) + hw_abort (me, "can't get a socket for %s:%d connection", + rv->host, rv->port); + + if (connect (sock, (struct sockaddr *) &server, sizeof server) >= 0) + { + rv->fd = sock; + + /* FIXME: init packet here. Maybe start packet too. */ + if (rv->watchdog_interval != 0) + hw_rv_send_wdog (me); + } + else + /* Stash the errno for later display, if some connection activity + is requested. Don't emit an error here; we might have been + called just for test purposes. */ + rv->saved_errno = errno; +} + +/* Local rv register reads end up here. */ + +static unsigned int +hw_rv_reg_read (struct hw *me, + void *dest, + int space, + unsigned_word addr, + unsigned int nr_bytes) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + unsigned8 addr_data[8] = ""; + unsigned32 a_l = H2LE_4 (addr - rv->reg_address + rv->remote_reg_address); + unsigned int len = 8; + + if (nr_bytes != 4) + hw_abort (me, "must be four byte read"); + + if (addr == rv->mbox_address) + hw_abort (me, "invalid read of mbox address 0x%x", + (unsigned) rv->mbox_address); + + memcpy (addr_data, &a_l, 4); + HW_TRACE ((me, "REG R 0x%x", addr)); + if (rv->dummy != NULL) + { + len = 8; + memcpy (addr_data + 4, rv->dummy + addr - rv->reg_address, 4); + } + else + { + hw_rv_send (me, RV_READ_CMD, addr_data, len); + hw_rv_handle_incoming (me, RV_READ_CMD, addr_data, &len); + } + + if (len != 8) + hw_abort (me, "read %d != 8 bytes returned", len); + HW_TRACE ((me, ":= 0x%02x%02x%02x%02x", + addr_data[7], addr_data[6], addr_data[5], addr_data[4])); + memcpy (dest, addr_data + 4, 4); + return nr_bytes; +} + +/* Local rv mbox requests (handle or put) end up here. */ + +static void +hw_rv_mbox (struct hw *me, unsigned_word address) +{ + unsigned8 buf[256+3]; + unsigned int cmd; + unsigned int rlen; + unsigned32 i; + unsigned int len + = hw_dma_read_buffer (me, buf, 0, address, 3); + + if (len != 3) + hw_abort (me, "mbox read %d != 3 bytes returned", len); + + cmd = buf[2]; + if (cmd != RV_MBOX_HANDLE_CMD && cmd != RV_MBOX_PUT_CMD) + hw_abort (me, "unsupported mbox command %d", cmd); + + len = buf[0] + buf[1]*256; + + if (len > sizeof (buf)) + hw_abort (me, "mbox cmd %d send size %d unsupported", cmd, len); + + rlen = hw_dma_read_buffer (me, buf + 3, 0, address + 3, len - 3); + if (rlen != len - 3) + hw_abort (me, "mbox read %d != %d bytes returned", rlen, len - 3); + + HW_TRACE ((me, "MBOX %s 0x%x..0x%x", + cmd == RV_MBOX_HANDLE_CMD ? "H" : "P", + address, address + len - 1)); + for (i = 0; i < rlen; i += 8) + HW_TRACE ((me, "0x%x: %02x %02x %02x %02x %02x %02x %02x %02x", + address + 3 + i, + buf[3+i], buf[4+i], buf[5+i], buf[6+i], buf[7+i], buf[8+i], + buf[9+i], buf[10+i])); + + len -= 3; + hw_rv_send (me, cmd, buf + 3, len); + + /* Note: both ..._PUT and ..._HANDLE get the ..._HANDLE reply. */ + hw_rv_handle_incoming (me, RV_MBOX_HANDLE_CMD, buf + 3, &len); + if (len > sizeof (buf)) + hw_abort (me, "mbox cmd %d receive size %d unsupported", cmd, len); + HW_TRACE ((me, "-> 0x%x..0x%x", address, address + len + 3 - 1)); + for (i = 0; i < len; i += 8) + HW_TRACE ((me, "0x%x: %02x %02x %02x %02x %02x %02x %02x %02x", + address + 3 + i, + buf[3+i], buf[4+i], buf[5+i], buf[6+i], buf[7+i], buf[8+i], + buf[9+i], buf[10+i])); + + len += 3; + buf[0] = len & 255; + buf[1] = len / 256; + rlen = hw_dma_write_buffer (me, buf, 0, address, len, 0); + if (rlen != len) + hw_abort (me, "mbox write %d != %d bytes", rlen, len); +} + +/* Local rv register writes end up here. */ + +static unsigned int +hw_rv_reg_write (struct hw *me, + const void *source, + int space, + unsigned_word addr, + unsigned int nr_bytes) +{ + hw_rv_device *rv = (hw_rv_device *) hw_data (me); + + unsigned8 addr_data[8] = ""; + unsigned32 a_l = H2LE_4 (addr - rv->reg_address + rv->remote_reg_address); + unsigned int len = 8; + + if (nr_bytes != 4) + hw_abort (me, "must be four byte write"); + + memcpy (addr_data, &a_l, 4); + memcpy (addr_data + 4, source, 4); + + if (addr == rv->mbox_address) + { + unsigned32 mbox_addr_le; + if (rv->dummy != NULL) + hw_abort (me, "mbox not supported for a dummy instance"); + memcpy (&mbox_addr_le, source, 4); + hw_rv_mbox (me, LE2H_4 (mbox_addr_le)); + return nr_bytes; + } + + HW_TRACE ((me, "REG W 0x%x := 0x%02x%02x%02x%02x", addr, + addr_data[7], addr_data[6], addr_data[5], addr_data[4])); + if (rv->dummy != NULL) + { + len = 8; + memcpy (rv->dummy + addr - rv->reg_address, addr_data + 4, 4); + } + else + { + hw_rv_send (me, RV_WRITE_CMD, addr_data, len); + hw_rv_handle_incoming (me, RV_WRITE_CMD, addr_data, &len); + } + + if (len != 8) + hw_abort (me, "read %d != 8 bytes returned", len); + + /* We had an access: tighten up all slack. */ + rv->next_period = 1; + + return nr_bytes; +} + +/* Instance initializer function. */ + +static void +hw_rv_finish (struct hw *me) +{ + hw_rv_device *rv = HW_ZALLOC (me, hw_rv_device); + int i; + const struct hw_property *mem_prop; + const struct hw_property *dummy_prop; + const struct hw_property *mbox_prop; + + set_hw_data (me, rv); + +#undef RV_GET_IPROP +#undef RV_GET_PROP +#define RV_GET_PROP(T, N, M, D) \ + do \ + { \ + if (hw_find_property (me, N) != NULL) \ + rv->M = hw_find_ ## T ## _property (me, N); \ + else \ + rv->M = (D); \ + } \ + while (0) +#define RV_GET_IPROP(N, M, D) RV_GET_PROP (integer, N, M, D) + + RV_GET_PROP (string, "host", host, "127.0.0.1"); + RV_GET_IPROP ("port", port, 10000); + RV_GET_IPROP ("remote-reg", remote_reg_address, 0); + RV_GET_IPROP ("max-poll-ticks", max_tick_poll_interval, 10000); + RV_GET_IPROP ("watchdog-interval", watchdog_interval, 30); + RV_GET_IPROP ("remote-mem", remote_mem_address, 0); + RV_GET_IPROP ("mem-burst-mask", mem_burst_mask, 0xffff); + RV_GET_IPROP ("intmultiple", intmultiple, 0); + + set_hw_io_read_buffer (me, hw_rv_reg_read); + set_hw_io_write_buffer (me, hw_rv_reg_write); + set_hw_ports (me, hw_rv_ports); + rv->next_period = 1; + + /* FIXME: We only support zero or one reg and zero or one mem area. */ + if (hw_find_property (me, "reg") != NULL) + { + reg_property_spec reg; + if (hw_find_reg_array_property (me, "reg", 0, ®)) + { + unsigned_word attach_address; + int attach_space; + unsigned int attach_size; + + hw_unit_address_to_attach_address (hw_parent (me), + ®.address, + &attach_space, + &attach_address, + me); + rv->reg_address = attach_address; + hw_unit_size_to_attach_size (hw_parent (me), + ®.size, + &attach_size, me); + rv->reg_size = attach_size; + if ((attach_address & 3) != 0) + hw_abort (me, "register block must be 4 byte aligned"); + hw_attach_address (hw_parent (me), + 0, + attach_space, attach_address, attach_size, + me); + } + else + hw_abort (me, "property \"reg\" has the wrong type"); + } + + dummy_prop = hw_find_property (me, "dummy"); + if (dummy_prop != NULL) + { + if (rv->reg_size == 0) + hw_abort (me, "dummy argument requires a \"reg\" property"); + + if (hw_property_type (dummy_prop) == integer_property) + { + unsigned32 dummyfill = hw_find_integer_property (me, "dummy"); + unsigned8 *dummymem = hw_malloc (me, rv->reg_size); + memset (dummymem, dummyfill, rv->reg_size); + rv->dummy = dummymem; + } + else + { + const char *dummyarg = hw_find_string_property (me, "dummy"); + unsigned8 *dummymem = hw_malloc (me, rv->reg_size); + FILE *f = fopen (dummyarg, "rb"); + + if (f == NULL) + hw_abort (me, "opening dummy-file \"%s\": %s", + dummyarg, strerror (errno)); + if (fread (dummymem, 1, rv->reg_size, f) != rv->reg_size) + hw_abort (me, "reading dummy-file \"%s\": %s", + dummyarg, strerror (errno)); + fclose (f); + rv->dummy = dummymem; + } + } + + mbox_prop = hw_find_property (me, "mbox"); + if (mbox_prop != NULL) + { + if (hw_property_type (mbox_prop) == integer_property) + { + signed_cell attach_address_sc + = hw_find_integer_property (me, "mbox"); + + rv->mbox_address = (unsigned32) attach_address_sc; + hw_attach_address (hw_parent (me), + 0, + 0, (unsigned32) attach_address_sc, 4, me); + } + else + hw_abort (me, "property \"mbox\" has the wrong type"); + } + + mem_prop = hw_find_property (me, "mem"); + if (mem_prop != NULL) + { + signed_cell attach_address_sc; + signed_cell attach_size_sc; + + /* Only specific names are reg_array_properties, the rest are + array_properties. */ + if (hw_property_type (mem_prop) == array_property + && hw_property_sizeof_array (mem_prop) == 2 * sizeof (attach_address_sc) + && hw_find_integer_array_property (me, "mem", 0, &attach_address_sc) + && hw_find_integer_array_property (me, "mem", 1, &attach_size_sc)) + { + /* Unfortunate choice of types forces us to dance around a bit. */ + rv->mem_address = (unsigned32) attach_address_sc; + rv->mem_size = (unsigned32) attach_size_sc; + if ((attach_address_sc & 3) != 0) + hw_abort (me, "memory block must be 4 byte aligned"); + } + else + hw_abort (me, "property \"mem\" has the wrong type"); + } + + hw_rv_map_ints (me); + + hw_rv_init_socket (me); + + /* We need an extra initialization pass, after all others currently + scheduled (mostly, after the simulation events machinery has been + initialized so the events we want don't get thrown out). */ + hw_rv_add_init (me); +} + +/* Our root structure; see dv-* build machinery for usage. */ + +const struct hw_descriptor dv_rv_descriptor[] = { + { RV_FAMILY_NAME, hw_rv_finish }, + { NULL } +}; diff --git a/sim/cris/rvdummy.c b/sim/cris/rvdummy.c new file mode 100644 index 0000000..633eddb --- /dev/null +++ b/sim/cris/rvdummy.c @@ -0,0 +1,536 @@ +/* Test-driver for the remote-virtual-component simulator framework + for GDB, the GNU Debugger. + + Copyright 2006 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Avoid any problems whatsoever building this program if we're not + also building hardware support. */ + +#if !WITH_HW +int +main (int argc, char *argv[]) +{ + return 2; +} +#else + +#ifdef HAVE_CONFIG_H +#include "cconfig.h" +#include "tconfig.h" +#endif + +#include "getopt.h" +#include "libiberty.h" + +#define _GNU_SOURCE +#include + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif + +/* Not guarded in dv-sockser.c, so why here. */ +#include +#include +#include +#include + +enum rv_command { + RV_READ_CMD = 0, + RV_WRITE_CMD = 1, + RV_IRQ_CMD = 2, + RV_MEM_RD_CMD = 3, + RV_MEM_WR_CMD = 4, + RV_MBOX_HANDLE_CMD = 5, + RV_MBOX_PUT_CMD = 6, + RV_WATCHDOG_CMD = 7 +}; + +enum opts { OPT_PORT = 1, OPT_TIMEOUT, OPT_VERBOSE }; + +struct option longopts[] = + { + {"port", required_argument, NULL, OPT_PORT}, + {"timeout", required_argument, NULL, OPT_TIMEOUT}, + {"verbose", no_argument, NULL, OPT_VERBOSE}, + {NULL, 0, NULL, 0} + }; + +int port = 10000; +time_t timeout = 30000; +char *progname = "(unknown)"; +int verbose = 0; + +/* Required forward-declarations. */ +static void handle_input_file (int, char *); + +/* Set up a "server" listening to the port in PORT for a raw TCP + connection. Return a file descriptor for the connection or -1 on + error. */ + +int setupsocket (void) +{ + int s; + socklen_t len; + int reuse = 1; + struct sockaddr_in sa_in; + struct sockaddr_in from; + + len = sizeof (from); + memset (&from, 0, len); + memset (&sa_in, 0, sizeof (sa_in)); + + s = socket (AF_INET, SOCK_STREAM, 0); + if (s < 0) + return -1; + + if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof reuse) != 0) + return -1; + + sa_in.sin_port = htons (port); + sa_in.sin_family = AF_INET; + + if (bind (s, (struct sockaddr *) & sa_in, sizeof sa_in) < 0) + return -1; + + if (listen (s, 1) < 0) + return -1; + + return accept (s, (struct sockaddr *) &from, &len); +} + +/* Basic host-to-little-endian 32-bit value. Could use the BFD + machinery, but let's avoid it for this only dependency. */ + +static void +h2le32 (unsigned char *dest, unsigned int val) +{ + dest[0] = val & 255; + dest[1] = (val >> 8) & 255; + dest[2] = (val >> 16) & 255; + dest[3] = (val >> 24) & 255; +} + +/* Send a blob of data. */ + +static void +send_output (int fd, unsigned char *buf, int nbytes) +{ + while (nbytes > 0) + { + ssize_t written = write (fd, buf, nbytes); + if (written < 0) + { + fprintf (stderr, "%s: write to socket failed: %s\n", + progname, strerror (errno)); + exit (2); + } + nbytes -= written; + } +} + +/* Receive a blob of data, NBYTES large. Compare to the first NCOMP + bytes of BUF; if not a match, write error message to stderr and + exit (2). Else put it in buf. */ + +static void +expect_input (int fd, unsigned char *buf, int nbytes, int ncomp) +{ + unsigned char byt; + int i; + + for (i = 0; i < nbytes; i++) + { + int r; + + do + { + errno = 0; + r = read (fd, &byt, 1); + } + while (r <= 0 && (r == 0 || errno == EAGAIN)); + + if (r != 1) + { + fprintf (stderr, "%s: read from socket failed: %s", + progname, strerror (errno)); + exit (2); + } + + if (i < ncomp && byt != buf[i]) + { + int j; + fprintf (stderr, "%s: unexpected input,\n ", progname); + if (i == 0) + fprintf (stderr, "nothing,"); + else + for (j = 0; j < i; j++) + fprintf (stderr, "%02x", buf[j]); + fprintf (stderr, "\nthen %02x instead of %02x\n", byt, buf[i]); + exit (2); + } + else + buf[i] = byt; + } +} + +/* Handle everything about a nil-terminated line of input. + Call exit (2) on error with error text on stderr. */ + +static void +handle_input (int fd, char *buf, char *fname, int lineno) +{ + int nbytes = 0; + int n = -1; + char *s = buf + 2; + unsigned int data; + static unsigned char bytes[1024]; + int i; + + memset (bytes, 0, sizeof bytes); + lineno++; + + if (buf[1] != ',') + goto syntax_error; + + switch (buf[0]) + { + /* Comment characters and empty lines. */ + case 0: case '!': case '#': + break; + + /* Include another file. */ + case '@': + handle_input_file (fd, s); + break; + + /* Raw input (to be expected). */ + case 'i': + do + { + n = -1; + sscanf (s, "%02x%n", &data, &n); + s += n; + if (n > 0) + bytes[nbytes++] = data; + } + while (n > 0); + expect_input (fd, bytes, nbytes, nbytes); + if (verbose) + { + printf ("i,"); + for (i = 0; i < nbytes; i++) + printf ("%02x", bytes[i]); + printf ("\n"); + } + break; + + /* Raw output (to be written). */ + case 'o': + do + { + n = -1; + sscanf (s, "%02x%n", &data, &n); + if (n > 0) + { + s += n; + bytes[nbytes++] = data; + } + } + while (n > 0); + if (*s != 0) + goto syntax_error; + send_output (fd, bytes, nbytes); + if (verbose) + { + printf ("o,"); + for (i = 0; i < nbytes; i++) + printf ("%02x", bytes[i]); + printf ("\n"); + } + break; + + /* Read a register. */ + case 'r': + { + unsigned int addr; + sscanf (s, "%x,%x%n", &addr, &data, &n); + if (n < 0 || s[n] != 0) + goto syntax_error; + bytes[0] = 11; + bytes[1] = 0; + bytes[2] = RV_READ_CMD; + h2le32 (bytes + 3, addr); + expect_input (fd, bytes, 11, 7); + h2le32 (bytes + 7, data); + send_output (fd, bytes, 11); + if (verbose) + printf ("r,%x,%x\n", addr, data); + } + break; + + /* Write a register. */ + case 'w': + { + unsigned int addr; + sscanf (s, "%x,%x%n", &addr, &data, &n); + if (n < 0 || s[n] != 0) + goto syntax_error; + bytes[0] = 11; + bytes[1] = 0; + bytes[2] = RV_WRITE_CMD; + h2le32 (bytes + 3, addr); + h2le32 (bytes + 7, data); + expect_input (fd, bytes, 11, 11); + send_output (fd, bytes, 11); + if (verbose) + printf ("w,%x,%x\n", addr, data); + } + break; + + /* Wait for some milliseconds. */ + case 't': + { + int del = 0; + struct timeval to; + sscanf (s, "%d%n", &del, &n); + if (n < 0 || s[n] != 0 || del == 0) + goto syntax_error; + + to.tv_sec = del / 1000; + to.tv_usec = (del % 1000) * 1000; + + if (select (0, NULL, NULL, NULL, &to) != 0) + { + fprintf (stderr, "%s: problem waiting for %d ms:\n %s\n", + progname, del, strerror (errno)); + exit (2); + } + if (verbose) + printf ("t,%d\n", del); + } + break; + + /* Expect a watchdog command. */ + case 'W': + if (*s != 0) + goto syntax_error; + bytes[0] = 3; + bytes[1] = 0; + bytes[2] = RV_WATCHDOG_CMD; + expect_input (fd, bytes, 3, 3); + if (verbose) + printf ("W\n"); + break; + + /* Send an IRQ notification. */ + case 'I': + sscanf (s, "%x%n", &data, &n); + if (n < 0 || s[n] != 0) + goto syntax_error; + bytes[0] = 7; + bytes[1] = 0; + bytes[2] = RV_IRQ_CMD; + h2le32 (bytes + 3, data); + send_output (fd, bytes, 7); + if (verbose) + printf ("I,%x\n", data); + break; + + /* DMA store (to CPU). */ + case 's': + { + unsigned int addr; + sscanf (s, "%x,%n", &addr, &n); + + if (n < 0 || s[n] == 0) + goto syntax_error; + s += n; + do + { + n = -1; + sscanf (s, "%02x%n", &data, &n); + if (n > 0) + { + s += n; + bytes[11 + nbytes++] = data; + } + } + while (n > 0); + + if (*s != 0) + goto syntax_error; + h2le32 (bytes, nbytes + 11); + bytes[2] = RV_MEM_WR_CMD; + h2le32 (bytes + 3, addr); + h2le32 (bytes + 7, nbytes); + send_output (fd, bytes, nbytes + 11); + if (verbose) + { + printf ("s,%x,", addr); + for (i = 0; i < nbytes; i++) + printf ("%02x", bytes[i]); + printf ("\n"); + } + } + break; + + /* DMA load (from CPU). */ + case 'l': + { + unsigned int addr; + sscanf (s, "%x,%n", &addr, &n); + + if (n < 0 || s[n] == 0) + goto syntax_error; + s += n; + do + { + n = -1; + sscanf (s, "%02x%n", &data, &n); + if (n > 0) + { + s += n; + bytes[11 + nbytes++] = data; + } + } + while (n > 0); + + if (*s != 0) + goto syntax_error; + h2le32 (bytes, nbytes + 11); + bytes[0] = 11; + bytes[1] = 0; + bytes[2] = RV_MEM_RD_CMD; + h2le32 (bytes + 3, addr); + h2le32 (bytes + 7, nbytes); + send_output (fd, bytes, 11); + bytes[0] = (nbytes + 11) & 255; + bytes[1] = ((nbytes + 11) >> 8) & 255; + expect_input (fd, bytes, nbytes + 11, nbytes + 11); + if (verbose) + { + printf ("l,%x,", addr); + for (i = 0; i < nbytes; i++) + printf ("%02x", bytes[i]); + printf ("\n"); + } + } + break; + + syntax_error: + default: + fprintf (stderr, "%s: invalid command line in %s:%d:\n %s", + progname, fname, lineno, strerror (errno)); + exit (2); + } +} + +/* Loop over the contents of FNAME, using handle_input to parse each line. + Errors to stderr, exit (2). */ + +static void +handle_input_file (int fd, char *fname) +{ + static char buf[2048] = {0}; + int lineno = 0; + FILE *f = fopen (fname, "r"); + + if (f == NULL) + { + fprintf (stderr, "%s: problem opening %s: %s\n", + progname, fname, strerror (errno)); + exit (2); + } + + /* Let's cut the buffer short, so we always get a newline. */ + while (fgets (buf, sizeof (buf) - 1, f) != NULL) + { + buf[strlen (buf) - 1] = 0; + lineno++; + handle_input (fd, buf, fname, lineno); + } + + fclose (f); +} + +int +main (int argc, char *argv[]) +{ + int optc; + int fd; + FILE *f; + int i; + + progname = argv[0]; + while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1) + switch (optc) + { + case OPT_PORT: + port = atoi (optarg); + break; + + case OPT_TIMEOUT: + timeout = (time_t) atoi (optarg); + break; + + case OPT_VERBOSE: + verbose = 1; + break; + } + + fd = setupsocket (); + if (fd < 0) + { + fprintf (stderr, "%s: problem setting up the connection: %s\n", + progname, strerror (errno)); + exit (2); + } + + for (i = optind; i < argc; i++) + handle_input_file (fd, argv[i]); + + /* FIXME: option-controlled test for remaining input? */ + close (fd); + return 1; +} +#endif diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 507ba57..86d19b2 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -1,5 +1,5 @@ /* Main simulator entry points specific to the CRIS. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Axis Communications. This file is part of the GNU simulators. @@ -78,7 +78,7 @@ static CGEN_DISASSEMBLER cris_disassemble_insn; static char cris_bare_iron = 0; /* Whether 0x9000000xx have simulator-specific meanings. */ -static char cris_have_900000xxif = 0; +char cris_have_900000xxif = 0; /* Records simulator descriptor so utilities like cris_dump_regs can be called from gdb. */ @@ -506,7 +506,15 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, memset (cpu->sighandler, 0, sizeof (cpu->sighandler)); cpu->make_thread_cpu_data = NULL; cpu->thread_cpu_data_size = 0; +#if WITH_HW + cpu->deliver_interrupt = NULL; +#endif } +#if WITH_HW + /* Always be cycle-accurate and call before/after functions if + with-hardware. */ + sim_profile_set_option (sd, "-model", PROFILE_MODEL_IDX, "on"); +#endif } /* Initialize various cgen things not done by common framework. diff --git a/sim/cris/sim-main.h b/sim/cris/sim-main.h index b35b927..483046d 100644 --- a/sim/cris/sim-main.h +++ b/sim/cris/sim-main.h @@ -1,5 +1,5 @@ /* Main header for the CRIS simulator, based on the m32r header. - Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Axis Communications. This file is part of the GNU simulators. @@ -117,6 +117,10 @@ struct cris_thread_info { char sigsuspended; }; +typedef int (*cris_interrupt_delivery_fn) (SIM_CPU *, + enum cris_interrupt_type, + unsigned int); + struct _sim_cpu { /* sim/common cpu base. */ sim_cpu_base base; @@ -132,6 +136,11 @@ struct _sim_cpu { CRIS_MISC_PROFILE cris_prev_misc_profile; #define CPU_CRIS_PREV_MISC_PROFILE(cpu) (& (cpu)->cris_prev_misc_profile) +#if WITH_HW + cris_interrupt_delivery_fn deliver_interrupt; +#define CPU_CRIS_DELIVER_INTERRUPT(cpu) (cpu->deliver_interrupt) +#endif + /* Simulator environment data. */ USI endmem; USI endbrk; diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index b1a5b54..e2a8ba5 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,7 @@ +2006-04-18 Nick Clifton + + * interp.c (sim_stop_reason): Fix typo. + 2005-11-28 Mark Mitchell * interp.c (gdb/signals.h): Include it. diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index 26f36ec..9caec41 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -1278,7 +1278,7 @@ sim_stop_reason (sd, reason, sigrc) case SIG_D10V_BUS: *reason = sim_stopped; - *reson = TARGET_SIGNAL_BUS; + *sigrc = TARGET_SIGNAL_BUS; break; default: /* some signal */ diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 65b8fae..e3c2283 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,8 @@ +2006-04-18 Nick Clifton + + * dv-tx3904tmr.c (deliver_tx3904tmr_tick): Add missing break + statement. + 2006-03-29 Hans-Peter Nilsson * configure: Regenerate. diff --git a/sim/mips/dv-tx3904tmr.c b/sim/mips/dv-tx3904tmr.c index c1c7b8c..89e0625 100644 --- a/sim/mips/dv-tx3904tmr.c +++ b/sim/mips/dv-tx3904tmr.c @@ -675,6 +675,7 @@ deliver_tx3904tmr_tick (struct hw *me, case 3: /* disabled */ default: + break; } /* update counter and report */ diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog index 06c27c2..061b45d 100644 --- a/sim/testsuite/ChangeLog +++ b/sim/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2006-04-08 Hans-Peter Nilsson + + * sim/cris/hw/rv-n-cris/irq6.ms: New test. + +2006-04-03 Hans-Peter Nilsson + + * sim/cris/hw: New directory for subdirectories with tests. + * sim/cris/hw/rv-n-cris: New directory with tests. + +2006-04-02 Hans-Peter Nilsson + + * sim/cris/asm/testutils.inc (test_h_mem): Use register prefix. + (testr_h_dr, test_h_dr, ldmem_h_gr, mvr_h_mem): Ditto. Correct + syntax. + + * sim/cris/asm/x0-v10.ms, sim/cris/asm/x0-v32.ms: Widen regexp for + stack pointer values. + 2006-02-23 Hans-Peter Nilsson * sim/cris/c/time2.c: New test. diff --git a/sim/testsuite/sim/cris/asm/testutils.inc b/sim/testsuite/sim/cris/asm/testutils.inc index 06e63c5..457d581 100644 --- a/sim/testsuite/sim/cris/asm/testutils.inc +++ b/sim/testsuite/sim/cris/asm/testutils.inc @@ -89,7 +89,8 @@ _start: ; Store a register into a word in memory .macro mvr_h_mem reg addr - move.d \reg,@\addr + move.d \addr,$r13 + move.d \reg,[$r13] .endm ; Store the current ps on the stack @@ -104,7 +105,8 @@ _start: ; Load a word value from memory .macro ldmem_h_gr addr reg - move.d @\addr,\reg + move.d \addr,$r13 + move.d [$r13],\reg .endm ; Add 2 general registers @@ -137,20 +139,20 @@ _start: ; Test the value of an immediate against a dedicated register .macro test_h_dr val reg - move.d \reg,r12 - test_h_gr \val r12 + move \reg,$r12 + test_h_gr \val $r12 .endm ; Test the value of an general register against a dedicated register .macro testr_h_dr gr dr - move.d \dr,r12 - testr_h_gr \gr r12 + move \dr,$r12 + testr_h_gr \gr $r12 .endm ; Compare an immediate with word in memory .macro test_h_mem val addr - ldmem_h_gr \addr r12 - test_h_gr \val r12 + ldmem_h_gr \addr $r12 + test_h_gr \val $r12 .endm ; Compare a general register with word in memory diff --git a/sim/testsuite/sim/cris/asm/x0-v10.ms b/sim/testsuite/sim/cris/asm/x0-v10.ms index 4ead73e..d8fa109 100644 --- a/sim/testsuite/sim/cris/asm/x0-v10.ms +++ b/sim/testsuite/sim/cris/asm/x0-v10.ms @@ -1,7 +1,7 @@ #mach: crisv10 #ld: --section-start=.text=0 -#output: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[cde][0-9a-f][0-9a-f] ixnzvc 0\n -#output: 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[cde][0-9a-f][0-9a-f] ixnzvc 1\n +#output: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[c-f][0-9a-f][0-9a-f] ixnzvc 0\n +#output: 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[c-f][0-9a-f][0-9a-f] ixnzvc 1\n #sim: --cris-trace=basic .include "break.ms" diff --git a/sim/testsuite/sim/cris/asm/x0-v32.ms b/sim/testsuite/sim/cris/asm/x0-v32.ms index a707f6d..7aafa62 100644 --- a/sim/testsuite/sim/cris/asm/x0-v32.ms +++ b/sim/testsuite/sim/cris/asm/x0-v32.ms @@ -1,7 +1,7 @@ #mach: crisv32 #ld: --section-start=.text=0 -#output: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[cde][0-9a-f][0-9a-f] ixnzvc 0 0\n -#output: 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[cde][0-9a-f][0-9a-f] ixnzvc 1 0\n +#output: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[c-f][0-9a-f][0-9a-f] ixnzvc 0 0\n +#output: 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3dfff[c-f][0-9a-f][0-9a-f] ixnzvc 1 0\n #sim: --cris-trace=basic .include "break.ms" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms new file mode 100644 index 0000000..c41f51f --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/host1.ms @@ -0,0 +1,8 @@ +#mach: crisv32 +#sim(crisv32): --hw-device "/rv/host localhost" + +# Check that we trivially resolve a hostname. + +#r @,@srcdir@/trivial4.r + + .include "trivial4.ms" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms new file mode 100644 index 0000000..f3e6f2e --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/irq1.ms @@ -0,0 +1,69 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" +#sim(crisv32): --hw-device "/rv/trace? true" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: IRQ 0x4\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543211\n +#output: /rv: REG R 0xd0000030\n +#output: /rv: IRQ 0x0\n +#output: /rv: := 0xeeff4455\n +#output: pass\n + +# Trivial test of interrupts. +# Locations of IRQ notifiers above depend on when the simulator is +# polled; adjustments may be needed (after checking that no poll is +# gone due to a bug!) + +#r W, +#r r,a8832,abcdef01 +#r I,4 +#r r,a8836,76543210 +#r r,a8836,76543211 +#r I,0 +#r r,a8830,eeff4455 + + .lcomm dummy,4 + + .include "testutils.inc" + start + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + test_h_mem 0xabcdef01 0xd0000032 + nop + nop + test_h_mem 0x76543210 0xd0000036 + ei + test_h_mem 0,dummy +wouldreturnhere: + nop +killme: + fail + +returnhere: + test_h_mem 0x76543211 0xd0000036 + test_h_mem 0xeeff4455 0xd0000030 + pass + +irq0x33: + .if ..asm.arch.cris.v32 + test_h_dr wouldreturnhere,$erp + move returnhere,$erp + rete + rfe + .else + move $dccr,$r0 + test_h_dr wouldreturnhere,$irp + move returnhere,$irp + reti + move $r0,$dccr + .endif + + singlevec irqvec1,0x33,irq0x33 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms new file mode 100644 index 0000000..19709e4 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/irq2.ms @@ -0,0 +1,44 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" +#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: IRQ 0xaa\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: REG R 0xd0000030\n +#output: /rv: IRQ 0x0\n +#output: /rv: := 0xeeff4455\n +#output: pass\n + +# Primarily to test multiple-int-bits set in dv-rv.c. + +#r W, +#r r,a8832,abcdef01 +#r I,6 +#r r,a8836,76543210 +#r I,0 +#r r,a8830,eeff4455 + + .lcomm dummy,4 + + .include "testutils.inc" + start + test_h_mem 0xabcdef01 0xd0000032 + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + ei + test_h_mem 0,dummy +killme: + fail + +irq0xea: + test_h_mem 0x76543210 0xd0000036 + test_h_mem 0xeeff4455 0xd0000030 + pass + + singlevec irqvec1,0xea,irq0xea diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms new file mode 100644 index 0000000..d96b6f5 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/irq3.ms @@ -0,0 +1,46 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" +#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/rv/intmultiple 0xaa" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: IRQ 0xaa\n +#output: /rv: IRQ 0xaa\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: REG R 0xd0000030\n +#output: /rv: IRQ 0x0\n +#output: /rv: := 0xeeff4455\n +#output: pass\n + +# Much like irq2.ms, but modified to check same-int-port-value-twice. + +#r W, +#r r,a8832,abcdef01 +#r I,6 +#r I,6 +#r r,a8836,76543210 +#r I,0 +#r r,a8830,eeff4455 + + .lcomm dummy,4 + + .include "testutils.inc" + start + test_h_mem 0xabcdef01 0xd0000032 + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + ei + test_h_mem 0,dummy +killme: + fail + +irq0xea: + test_h_mem 0x76543210 0xd0000036 + test_h_mem 0xeeff4455 0xd0000030 + pass + + singlevec irqvec1,0xea,irq0xea diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms new file mode 100644 index 0000000..9e16b5c --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/irq4.ms @@ -0,0 +1,46 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int ignore_previous" +#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int ignore_previous" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: IRQ 0x4\n +#output: /rv: IRQ 0x8\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: REG R 0xd0000030\n +#output: /rv: IRQ 0x0\n +#output: /rv: := 0xeeff4455\n +#output: pass\n + +# Much like irq3.ms, but modified to test multiple-int ignore_previous. + +#r W, +#r r,a8832,abcdef01 +#r I,4 +#r I,8 +#r r,a8836,76543210 +#r I,0 +#r r,a8830,eeff4455 + + .lcomm dummy,4 + + .include "testutils.inc" + start + test_h_mem 0xabcdef01 0xd0000032 + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + ei + test_h_mem 0,dummy +killme: + fail + +irq0x34: + test_h_mem 0x76543210 0xd0000036 + test_h_mem 0xeeff4455 0xd0000030 + pass + + singlevec irqvec1,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms new file mode 100644 index 0000000..4ecc5a6 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/irq5.ms @@ -0,0 +1,46 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int 0xae" +#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/cris/multiple-int 0xae" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: IRQ 0x4\n +#output: /rv: IRQ 0x8\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: REG R 0xd0000030\n +#output: /rv: IRQ 0x0\n +#output: /rv: := 0xeeff4455\n +#output: pass\n + +# Much like irq4.ms, but modified to test vector case for multiple-int. + +#r W, +#r r,a8832,abcdef01 +#r I,4 +#r I,8 +#r r,a8836,76543210 +#r I,0 +#r r,a8830,eeff4455 + + .lcomm dummy,4 + + .include "testutils.inc" + start + test_h_mem 0xabcdef01 0xd0000032 + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + ei + test_h_mem 0,dummy +killme: + fail + +irq0xae: + test_h_mem 0x76543210 0xd0000036 + test_h_mem 0xeeff4455 0xd0000030 + pass + + singlevec irqvec1,0xae,irq0xae diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms new file mode 100644 index 0000000..9e40f4a --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/irq6.ms @@ -0,0 +1,99 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" +#sim(crisv32): --hw-device "/rv/trace? true" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: IRQ 0x4\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: REG R 0xd0000030\n +#output: /rv: IRQ 0x0\n +#output: /rv: IRQ 0x8\n +#output: /rv: := 0xeeff4455\n +#output: /rv: REG R 0xd0000034\n +#output: /rv: := 0xdd001122\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0xaaeeff44\n +#output: /rv: REG R 0xd000003c\n +#output: /rv: := 0xff445511\n +#output: pass\n + +# Test two successive ints; that flags are disabled when an interrupt +# is taken, and then automatically (or by register restore) enabled at +# return. + +#r W, +#r r,a8832,abcdef01 +#r I,4 +#r r,a8836,76543210 +#r I,0 +#r I,8 +#r r,a8830,eeff4455 +#r r,a8834,dd001122 +#r r,a8838,aaeeff44 +#r r,a883c,ff445511 + + .lcomm dummy,4 + + .include "testutils.inc" + start + test_h_mem 0xabcdef01 0xd0000032 + moveq -1,$r4 + + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + + ei + test_h_mem 0,dummy + + ; Here after the first interrupt, or perhaps the second interrupt is + ; taken directly; leave it optional. Anyway, the second interrupt + ; should be taken no later than this branch. + test_h_mem 0,dummy + +killme: + fail + +irq0x33: + .if ..asm.arch.cris.v32 + ; Nothing needed to save flags - "shift" should happen, and back at rfe. + .else + ; The missing sim support for interrupt-excluding instructions is matched + ; by the flaw that sim doesn't service interrupts in straight code. + ; So, we can use a sequence that would work on actual hardware. + move $dccr,$r5 + di + .endif + + test_h_mem 0x76543210 0xd0000036 + test_h_mem 0xeeff4455 0xd0000030 + test_h_mem 0xdd001122 0xd0000034 + moveq -22,$r4 + + .if ..asm.arch.cris.v32 + move irqvec2,$ebp + rete + rfe + .else + move irqvec2,$ibr + reti + move $r5,$dccr + .endif + + pass + +irq0x34: + test_h_mem 0xaaeeff44 0xd0000038 + test_h_mem 0xff445511 0xd000003c + cmpq -22,$r4 + bne killme + nop + pass + + singlevec irqvec1,0x33,irq0x33 + + singlevec irqvec2,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms new file mode 100644 index 0000000..ee0f54c --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/mbox1.ms @@ -0,0 +1,88 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" +#sim(crisv32): --hw-device "/rv/trace? true" +#output: /rv: WD\n +#output: /rv: MBOX H 0x1001d..0x10037\n +#output: /rv: 0x10020: 12 23 34 56 79 8a bd de\n +#output: /rv: 0x10028: fb ad ba db ad 56 78 9a\n +#output: /rv: 0x10030: fd e1 23 45 66 54 32 1a\n +#output: /rv: -> 0x1001d..0x10027\n +#output: /rv: 0x10020: aa 55 77 88 32 10 ee cc\n +#output: /rv: MBOX P 0xfffd..0x1001f\n +#output: /rv: 0x10000: aa 55 12 23 34 56 79 8a\n +#output: /rv: 0x10008: bd de fb ad ba db ad 56\n +#output: /rv: 0x10010: 78 9a fd e1 23 45 66 54\n +#output: /rv: 0x10018: 32 1a ac cb be ed db ed\n +#output: /rv: -> 0xfffd..0x10017\n +#output: /rv: 0x10000: 11 22 56 78 ee dd 12 ab\n +#output: /rv: 0x10008: 55 aa ee 00 42 12 27 98\n +#output: /rv: 0x10010: 88 55 22 33 66 77 22 45\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0x76543211\n +#output: pass\n + +# Trivial test of mailbox commands. + +#r W, +#r i,1b000512233456798abddefbadbadbad56789afde123456654321a +#r o,0b0005aa5577883210eecc +#r i,230006aa5512233456798abddefbadbadbad56789afde123456654321aaccbbeeddbed +#r o,1b000511225678eedd12ab55aaee00421227988855223366772245 +#r r,a8838,76543211 + + .include "testutils.inc" + start + move.w 0x1b,$r0 + move.d 0x1001d,$r1 + move.w $r0,[$r1+] + moveq 5,$r0 + move.b $r0,[$r1] + mvi_h_mem 0x56342312 0x10020 + mvi_h_mem 0xdebd8a79 0x10024 + mvi_h_mem 0xdbbaadfb 0x10028 + mvi_h_mem 0x9a7856ad 0x1002c + mvi_h_mem 0x4523e1fd 0x10030 + mvi_h_mem 0x1a325466 0x10034 + + mvi_h_mem 0x1001d 0xc000f000 + + move.d 0x1001d,$r0 + movu.w [$r0+],$r1 + test_h_gr 0xb $r1 + movu.b [$r0],$r1 + test_h_gr 0x5 $r1 + test_h_mem 0x887755aa 0x10020 + test_h_mem 0xccee1032 0x10024 + + move.w 0x23,$r0 + move.d 0xfffd,$r1 + move.w $r0,[$r1+] + moveq 6,$r0 + move.b $r0,[$r1] + mvi_h_mem 0x231255aa 0x10000 + mvi_h_mem 0x8a795634 0x10004 + mvi_h_mem 0xadfbdebd 0x10008 + mvi_h_mem 0x56addbba 0x1000c + mvi_h_mem 0xe1fd9a78 0x10010 + mvi_h_mem 0x54664523 0x10014 + mvi_h_mem 0xcbac1a32 0x10018 + mvi_h_mem 0xeddbedbe 0x1001c + + mvi_h_mem 0xfffd 0xc000f000 + + move.d 0xfffd,$r0 + movu.w [$r0+],$r1 + test_h_gr 0x1b $r1 + movu.b [$r0],$r1 + test_h_gr 0x6 $r1 + test_h_mem 0x78562211 0x10000 + test_h_mem 0xab12ddee 0x10004 + test_h_mem 0x00eeaa55 0x10008 + test_h_mem 0x98271242 0x1000c + test_h_mem 0x33225588 0x10010 + test_h_mem 0x45227766 0x10014 + + test_h_mem 0x76543211 0xd0000038 + pass + + .fill 65536*2+128,1,0 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms new file mode 100644 index 0000000..ee5c4f5 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/mem1.ms @@ -0,0 +1,100 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" +#sim(crisv32): --hw-device "/rv/trace? true" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: DMA W 0x20020..0x2003f\n +#output: /rv: 0x20020: 12 23 34 56\n +#output: /rv: 0x20024: 79 8a bd de\n +#output: /rv: 0x20028: fb ad ba db\n +#output: /rv: 0x2002c: ad 56 78 9a\n +#output: /rv: 0x20030: fd e1 23 45\n +#output: /rv: 0x20034: 66 54 32 1a\n +#output: /rv: 0x20038: ac cb be ed\n +#output: /rv: 0x2003c: db ed aa da\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0x76543211\n +#output: /rv: DMA R 0x20000..0x2001f\n +#output: /rv: 0x20000: aa 55 12 23\n +#output: /rv: 0x20004: 34 56 79 8a\n +#output: /rv: 0x20008: bd de fb ad\n +#output: /rv: 0x2000c: ba db ad 56\n +#output: /rv: 0x20010: 78 9a fd e1\n +#output: /rv: 0x20014: 23 45 66 54\n +#output: /rv: 0x20018: 32 1a ac cb\n +#output: /rv: 0x2001c: be ed db ed\n +#output: /rv: IRQ 0x8\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0x76543212\n +#output: pass\n + +# Trivial test of DMA. + +# Locations of IRQ notifiers above depend on when the simulator is +# polled; adjustments may be needed (after checking that no poll is +# gone due to a bug!) + +#r W, +#r r,a8836,76543210 +#r s,e020,12233456798abddefbadbadbad56789afde123456654321aaccbbeeddbedaada +#r r,a8838,76543211 +#r l,e000,aa5512233456798abddefbadbadbad56789afde123456654321aaccbbeeddbed +#r I,8 +#r r,a8838,76543212 + + .include "testutils.inc" + start + test_h_mem 0x76543210 0xd0000036 + + move.d 0x2003f,$r1 + move.d 0x10000,$r3 +0: + test.b [$r1] + bne 1f + subq 1,$r3 + bne 0b + nop + +1: + test_h_mem 0x56342312 0x20020 + test_h_mem 0xdebd8a79 0x20024 + test_h_mem 0xdbbaadfb 0x20028 + test_h_mem 0x9a7856ad 0x2002c + test_h_mem 0x4523e1fd 0x20030 + test_h_mem 0x1a325466 0x20034 + test_h_mem 0xedbecbac 0x20038 + test_h_mem 0xdaaaeddb 0x2003c + + move.d 0x20020,$r0 + move.d 0x20000,$r1 + move.w 0x55aa,$r2 + move.w $r2,[r1+] + .rept 8 + move.d [$r0+],$r2 + move.d $r2,[$r1+] + .endr + + test_h_mem 0x76543211 0xd0000038 + + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + ei + move.d 0x100000,$r9 +0: + subq 1,$r9 + bne 0b + nop +killme: + fail + +irq0x34: + test_h_mem 0x76543212 0xd0000038 + pass + + .fill 65536*2+128,1,0 + + singlevec irqvec1,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms new file mode 100644 index 0000000..b676249 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/mem2.ms @@ -0,0 +1,104 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" +#sim(crisv32): --hw-device "/rv/trace? true" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: DMA W 0x20020..0x20043\n +#output: /rv: 0x20020: 12 23 34 56\n +#output: /rv: 0x20024: 79 8a bd de\n +#output: /rv: 0x20028: fb ad ba db\n +#output: /rv: 0x2002c: ad 56 78 9a\n +#output: /rv: 0x20030: fd e1 23 45\n +#output: /rv: 0x20034: 66 54 32 1a\n +#output: /rv: 0x20038: ac cb be ed\n +#output: /rv: 0x2003c: db ed aa da\n +#output: /rv: 0x20040: 00 aa bb cc\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0x76543211\n +#output: /rv: DMA R 0x20000..0x20023\n +#output: /rv: 0x20000: aa 55 12 23\n +#output: /rv: 0x20004: 34 56 79 8a\n +#output: /rv: 0x20008: bd de fb ad\n +#output: /rv: 0x2000c: ba db ad 56\n +#output: /rv: 0x20010: 78 9a fd e1\n +#output: /rv: 0x20014: 23 45 66 54\n +#output: /rv: 0x20018: 32 1a ac cb\n +#output: /rv: 0x2001c: be ed db ed\n +#output: /rv: 0x20020: aa da 00 aa\n +#output: /rv: IRQ 0x8\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0x76543212\n +#output: pass\n + +# This is a slight variation of mem1.ms just to trig the "buffer needs +# to be malloced for large request size" for the DMA request. + +# Locations of IRQ notifiers above depend on when the simulator is +# polled; adjustments may be needed (after checking that no poll is +# gone due to a bug!) + +#r W, +#r r,a8836,76543210 +#r s,e020,12233456798abddefbadbadbad56789afde123456654321aaccbbeeddbedaada00aabbcc +#r r,a8838,76543211 +#r l,e000,aa5512233456798abddefbadbadbad56789afde123456654321aaccbbeeddbedaada00aa +#r I,8 +#r r,a8838,76543212 + + .include "testutils.inc" + start + test_h_mem 0x76543210 0xd0000036 + + move.d 0x2003f,$r1 + move.d 0x10000,$r3 +0: + test.b [$r1] + bne 1f + subq 1,$r3 + bne 0b + nop + +1: + test_h_mem 0x56342312 0x20020 + test_h_mem 0xdebd8a79 0x20024 + test_h_mem 0xdbbaadfb 0x20028 + test_h_mem 0x9a7856ad 0x2002c + test_h_mem 0x4523e1fd 0x20030 + test_h_mem 0x1a325466 0x20034 + test_h_mem 0xedbecbac 0x20038 + test_h_mem 0xdaaaeddb 0x2003c + test_h_mem 0xccbbaa00 0x20040 + + move.d 0x20020,$r0 + move.d 0x20000,$r1 + move.w 0x55aa,$r2 + move.w $r2,[r1+] + .rept 9 + move.d [$r0+],$r2 + move.d $r2,[$r1+] + .endr + + test_h_mem 0x76543211 0xd0000038 + + .if ..asm.arch.cris.v32 + move irqvec1,$ebp + .else + move irqvec1,$ibr + .endif + ei + move.d 0x100000,$r9 +0: + subq 1,$r9 + bne 0b + nop +killme: + fail + +irq0x34: + test_h_mem 0x76543212 0xd0000038 + pass + + .fill 65536*2+128,1,0 + + singlevec irqvec1,0x34,irq0x34 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms new file mode 100644 index 0000000..baf1ed9 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/poll1.ms @@ -0,0 +1,22 @@ +#mach: crisv32 +#sim(crisv32): --hw-device "/rv/dummy 0x12" + +# A variant of trivial2.ms to check that the right thing happens when +# we reach the poll function with a dummy device. + + .include "testutils.inc" + start + move.d 0xd0000000,$r0 + move.d [$r0+],$r3 + cmp.d 0x12121212,$r3 + beq ok + nop +bad: + fail +ok: + move.d 0x10000,$r10 +0: + bne 0b + subq 1,$r10 + + pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/quit.s b/sim/testsuite/sim/cris/hw/rv-n-cris/quit.s new file mode 100644 index 0000000..8c1d239 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/quit.s @@ -0,0 +1,4 @@ +; Trivial target simulator program that just exits. + .include "testutils.inc" + startnostack + quit diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp b/sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp new file mode 100644 index 0000000..6f3c8f3 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/rvc.exp @@ -0,0 +1,241 @@ +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Miscellaneous CRIS simulator testcases in assembly code, testing +# dv-rv.c and dv-cris.c functions. + +# Check whether dv-rv and dv-cris are present. + +proc sim_has_rv_and_cris {} { + global srcdir + global subdir + global SIMFLAGS + global global_as_options + global global_ld_options + global global_sim_options + + # We need to assemble and link a trivial program and pass that, in + # order to test successful exit. + + # A bit of duplication here for the assembling and linking part; + # what we want to do it to run the simulator without affecting the + # PASS/FAIL counters, and we can use e.g. run_sim_test for that. + + if ![info exists global_as_options] { + set global_as_options "" + } + if ![info exists global_ld_options] { + set global_ld_options "" + } + if ![info exists global_sim_options] { + set global_sim_options "" + } + + set comp_output [target_assemble $srcdir/$subdir/quit.s quit.o \ + "-I$srcdir/$subdir $global_as_options"] + + if ![string match "" $comp_output] { + verbose -log "$comp_output" 3 + fail "rv sim test setup (assembling)" + return 0 + } + + set comp_output [target_link quit.o quit.x "$global_ld_options"] + + if ![string match "" $comp_output] { + verbose -log "$comp_output" 3 + fail "rv sim test setup (linking)" + return 0 + } + + set result \ + [sim_run quit.x \ + "$global_sim_options --hw-device rv --hw-device cris --hw-info" \ + "" "" ""] + set return_code [lindex $result 0] + set output [lindex $result 1] + + if { "$return_code" == "pass" } { + return 1 + } + + return 0 +} + +# Similar to slurp_options, but lines are fixed format "^#r ..." (not +# "^#{ws}*r:{ws}+" to avoid intruding on slurp_options syntax). Only +# trailing whitespace of the "..." is trimmed. Beware that lines +# including parameters may not contain ":". + +proc slurp_rv { file } { + if [catch { set f [open $file r] } x] { + #perror "couldn't open `$file': $x" + perror "$x" + return -1 + } + set rv_array {} + # whitespace expression + set ws {[ ]*} + # whitespace is ignored at the end of a line. + set pat "^#r (.*)$ws\$" + # Allow arbitrary lines until the first option is seen. + set seen_opt 0 + while { [gets $f line] != -1 } { + set line [string trim $line] + # Whitespace here is space-tab. + if [regexp $pat $line xxx cmd] { + # match! + lappend rv_array $cmd + set seen_opt 1 + } else { + if { $seen_opt } { + break + } + } + } + close $f + return $rv_array +} + +# The main test loop. + +if [istarget cris*-*-*] { + global ASFLAGS_FOR_TARGET + set has_rv_and_cris [sim_has_rv_and_cris] + global global_as_options + global global_ld_options + global global_sim_options + + set saved_global_sim_options $global_sim_options + set saved_global_ld_options $global_ld_options + set rvdummy "[file dirname [board_info target sim]]/rvdummy" + + # All machines we test and the corresponding assembler option. + # We'll only ever test v10 and higher here. + + set combos {{"crisv10" "--march=v10 --no-mul-bug-abort"} + {"crisv32" "--march=v32"}} + + # We need to pass different assembler flags for each machine. + # Specifying it here rather than adding a specifier to each and every + # test-file is preferrable. + + foreach combo $combos { + set mach [lindex $combo 0] + set ASFLAGS_FOR_TARGET "[lindex $combo 1]" + + # The .ms suffix is for "miscellaneous .s". + foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.ms]] { + + # If we're only testing specific files and this isn't one of them, + # skip it. + if ![runtest_file_p $runtests $src] { + continue + } + + # Whoever runs the test should be alerted that not all + # testcases have been checked; that's why we do the loop + # and don't just return at the top. + if !$has_rv_and_cris { + untested $src + continue + } + + set sim_defaults "--hw-file $srcdir/$subdir/std.dev" + set ld_defaults "--section-start=.text=0" + + # We parse options an extra time besides in run_sim_test, + # to determine if our defaults should be overridden. + + set opt_array [slurp_options $src] + foreach i $opt_array { + set opt_name [lindex $i 0] + set opt_machs [lindex $i 1] + set opt_val [lindex $i 2] + + # Allow concatenating to the default options by + # specifying a mach. + if { $opt_name == "sim" && $opt_machs == "" } { + set sim_defaults "" + } + + if { $opt_name == "ld" && $opt_machs == "" } { + set ld_defaults "" + } + } + + set rvdummy_id -1 + set hostcmds [slurp_rv $src] + + if { $hostcmds != "" } { + # I guess we could ask to have rvdummy executed on a + # remote host, but it looks like too much trouble for + # a feature rarely used. + if [is_remote host] { + untested $src + continue + } + + set src_components [file split $src] + set rvfile "[lindex $src_components \ + [expr [llength $src_components] - 1]].r" + + if [catch { set f [open $rvfile w] } x] { + error "$x" + } { + set contents [join $hostcmds "\n"] + + # Make it possible to use files from the test + # source directory; expected with the @-command. + regsub -all "@srcdir@" $contents "$srcdir/$subdir" contents + + verbose "rv: $contents" 2 + puts $f $contents + close $f + } + + spawn -noecho $rvdummy "$rvfile" + if { $spawn_id < 0 } { + error "Couldn't spawn $rvdummy" + continue + } + set rvdummy_id $spawn_id + } + + # Unfortunately this seems like the only way to pass + # additional sim, ld etc. options to run_sim_test. + set global_sim_options "$saved_global_sim_options $sim_defaults" + set global_ld_options "$saved_global_ld_options $ld_defaults" + run_sim_test $src $mach + set global_sim_options $saved_global_sim_options + set global_ld_options $saved_global_ld_options + + # Stop the rvdummy, if it's still running. We need to + # wait on it anyway to avoid it turning into a zombie. + if { $rvdummy_id != -1 } { + close -i $rvdummy_id + wait -i $rvdummy_id + + # Gleaned from framework.exp, this seems an indicator + # to whether the test had expected outcome. If so, we + # want to remove the rv-file. + if { $exit_status == 0 } { + file delete $rvfile + } + } + } + } +} diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/std.dev b/sim/testsuite/sim/cris/hw/rv-n-cris/std.dev new file mode 100644 index 0000000..9fefcbb --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/std.dev @@ -0,0 +1,8 @@ +/rv/reg 0xd0000000 64 +/rv/remote-reg 0xa8800 +/rv/intnum 4 2 +/cris/vec-for-int 4 0x33 8 0x34 0xaa 0xea +/rv/mem 0x20000 0x400 +/rv/remote-mem 0xe000 +/rv/mbox 0xc000f000 +/rv > int int /cris diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc b/sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc new file mode 100644 index 0000000..e707abf --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/testutils.inc @@ -0,0 +1,22 @@ + .include "../../asm/testutils.inc" + +# Define an exception vector table "vecname" with a single +# vector number "n" as "entry", all others "other". +# V32 only needs 1<<10 alignment, earlier versions need 1<<16. + .macro singlevec vecname vecno entry other=killme + .section .text.exvec + .p2align 16 +\vecname: + .if (\vecno) + .rept \vecno + .dword \other + .endr + .endif + .dword \entry + .if (\vecno)-255 + .rept 256-(\vecno)-1 + .dword \other + .endr + .endif + .previous + .endm diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms new file mode 100644 index 0000000..a219b04 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial1.ms @@ -0,0 +1,17 @@ +#mach: crisv32 +#sim(crisv32): --hw-info +#output: /\n +#output: /rv\n +#output: /rv/reg 0xd0000000 0x40\n +#output: /rv/remote-reg 0xa8800\n +#output: /rv/intnum 0x4 0x2\n +#output: /rv/mem 0x20000 0x400\n +#output: /rv/remote-mem 0xe000\n +#output: /rv/mbox 0xc000f000\n +#output: /rv > int int /cris\n +#output: /cris\n +#output: /cris/vec-for-int 0x4 0x33 0x8 0x34 0xaa 0xea\n + +# Test expected --hw-info output and startup paths of components. + + .include "quit.s" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms new file mode 100644 index 0000000..b633445 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial2.ms @@ -0,0 +1,21 @@ +#mach: crisv32 +#sim(crisv32): --hw-device "/rv/dummy 0x12" + +# Test dummy settings: set from value. + + .include "testutils.inc" + start + move.d 0xd0000000,$r0 + move.d [$r0+],$r3 + cmp.d 0x12121212,$r3 + beq ok + nop +bad: + fail +ok: + moveq -1,$r3 + move.d $r3,[$r0] + cmp.d [$r0],$r3 + bne bad + nop + pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms new file mode 100644 index 0000000..1f23b49 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial3.ms @@ -0,0 +1,20 @@ +#mach: crisv32 +#sim(crisv32): --hw-device "/rv/dummy /dev/zero" + +# Test dummy settings: set from file. + + .include "testutils.inc" + start + move.d 0xd0000000,$r0 + move.d [$r0+],$r3 + beq ok + nop +bad: + fail +ok: + moveq -1,$r3 + move.d $r3,[$r0] + cmp.d [$r0],$r3 + bne bad + nop + pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms new file mode 100644 index 0000000..6108160 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.ms @@ -0,0 +1,22 @@ +#mach: crisv32 +#r @,@srcdir@/trivial4.r + +# Test read and writes. + + .include "testutils.inc" + start + move.d 0xd0000032,$r0 + move.d [$r0+],$r3 + cmp.d 0xabcdef01,$r3 + beq ok + nop +bad: + fail +ok: + move.d 0xaabbccdd,$r3 + move.d $r3,[$r0] + move.d [$r0],$r3 + cmp.d 0x76543210,$r3 + bne bad + nop + pass diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r new file mode 100644 index 0000000..b4896a0 --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial4.r @@ -0,0 +1,4 @@ +W, +r,a8832,abcdef01 +w,a8836,aabbccdd +r,a8836,76543210 diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms new file mode 100644 index 0000000..849f17e --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/trivial5.ms @@ -0,0 +1,16 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" +#sim(crisv32): --hw-device "/rv/trace? true" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000032\n +#output: /rv: := 0xabcdef01\n +#output: /rv: REG W 0xd0000036 := 0xaabbccdd\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: pass\n + +# Test trace output for read and write. + +#r @,@srcdir@/trivial4.r + + .include "trivial4.ms" diff --git a/sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms b/sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms new file mode 100644 index 0000000..91af7fc --- /dev/null +++ b/sim/testsuite/sim/cris/hw/rv-n-cris/wd1.ms @@ -0,0 +1,33 @@ +#mach: crisv10 crisv32 +#sim(crisv10): --hw-device "/rv/trace? true" --hw-device "/rv/watchdog-interval 1" +#sim(crisv32): --hw-device "/rv/trace? true" --hw-device "/rv/watchdog-interval 1" --hw-device "/rv/max-poll-ticks 1000" +#output: /rv: WD\n +#output: /rv: REG R 0xd0000036\n +#output: /rv: := 0x76543210\n +#output: /rv: WD\n +#output: /rv: DMA W 0x20000..0x20003\n +#output: /rv: 0x20000: 01 02 03 04\n +#output: /rv: REG R 0xd0000038\n +#output: /rv: := 0x76543211\n +#output: pass\n + +#r W, +#r r,a8836,76543210 +#r W, +#r s,e000,01020304 +#r r,a8838,76543211 + + .include "testutils.inc" + start + mvi_h_mem 0 0x20000 + test_h_mem 0x76543210 0xd0000036 + + move.d 0x20000,$r1 +0: + test.b [$r1] + beq 0b + nop + test_h_mem 0x76543211 0xd0000038 + pass + + .fill 65536*2+128,1,0 -- cgit v1.1