diff options
-rw-r--r-- | gdb/testsuite/gdb.c++/ambiguous.cc | 110 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/ambiguous.exp | 235 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/ctti.exp | 268 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd.cc | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd1.cc | 16 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd2.cc | 22 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/cttiadd3.cc | 33 | ||||
-rw-r--r-- | readline/doc/manvers.texinfo | 6 | ||||
-rw-r--r-- | readline/examples/rlversion.c | 21 | ||||
-rw-r--r-- | readline/rlstdc.h | 79 | ||||
-rw-r--r-- | readline/savestring.c | 33 | ||||
-rw-r--r-- | readline/shlib/Makefile.in | 316 | ||||
-rwxr-xr-x | readline/support/shlib-install | 105 | ||||
-rwxr-xr-x | readline/support/shobj-conf | 341 |
14 files changed, 1614 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.c++/ambiguous.cc b/gdb/testsuite/gdb.c++/ambiguous.cc new file mode 100644 index 00000000000..6ee7bc18ea9 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.cc @@ -0,0 +1,110 @@ + +void marker1() +{ + return; +} + +class A1 { +public: + int x; + int y; +}; + +class A2 { +public: + int x; + int y; +}; + +class A3 { +public: + int x; + int y; +}; + +class X : public A1, public A2 { +public: + int z; +}; + +class L : public A1 { +public: + int z; +}; + +class LV : public virtual A1 { +public: + int z; +}; + +class M : public A2 { +public: + int w; +}; + +class N : public L, public M { +public: + int r; +}; + +class K : public A1 { +public: + int i; +}; + +class KV : public virtual A1 { +public: + int i; +}; + +class J : public K, public L { +public: + int j; +}; + +class JV : public KV, public LV { +public: + int jv; +}; + +class JVA1 : public KV, public LV, public A1 { +public: + int jva1; +}; + +class JVA2 : public KV, public LV, public A2 { +public: + int jva2; +}; + +class JVA1V : public KV, public LV, public virtual A1 { +public: + int jva1v; +}; + +int main() +{ + A1 a1; + A2 a2; + A3 a3; + X x; + L l; + M m; + N n; + K k; + J j; + JV jv; + JVA1 jva1; + JVA2 jva2; + JVA1V jva1v; + + int i; + + i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j; + + marker1(); + +} + + + diff --git a/gdb/testsuite/gdb.c++/ambiguous.exp b/gdb/testsuite/gdb.c++/ambiguous.exp new file mode 100644 index 00000000000..998b47894c5 --- /dev/null +++ b/gdb/testsuite/gdb.c++/ambiguous.exp @@ -0,0 +1,235 @@ +# Copyright (C) 1998 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file is part of the gdb testsuite + +# tests relating to ambiguous class members +# Written by Satish Pai <pai@apollo.hp.com> 1997-07-28 + +# This file is part of the gdb testsuite + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# + +set prms_id 0 +set bug_id 0 + +set testfile "ambiguous" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# +# set it up at a breakpoint so we can play with the variable values +# +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + +send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" + send_gdb "cont\n" + gdb_expect { + -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { + send_gdb "up\n" + gdb_expect { + -re ".*$gdb_prompt $" { pass "up from marker1" } + timeout { fail "up from marker1" } + } + } + -re "$gdb_prompt $" { fail "continue to marker1" } + timeout { fail "(timeout) continue to marker1" } + } + +# print out various class objects' members. The values aren't +# important, just check that the warning is emitted at the +# right times. + +# X is derived from A1 and A2; both A1 and A2 have a member 'x' +send_gdb "print x.x\n" +gdb_expect { + -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print x.x" + } + -re ".*$gdb_prompt $" { fail "print x.x" } + timeout { fail "(timeout) print x.x" } +} + + +# N is derived from A1 and A2, but not immediately -- two steps +# up in the hierarchy. Both A1 and A2 have a member 'x'. +send_gdb "print n.x\n" +gdb_expect { + -re "warning: x ambiguous; using N::M::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re "warning: x ambiguous; using N::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print n.x" + } + -re ".*$gdb_prompt $" { fail "print n.x" } + timeout { fail "(timeout) print n.x" } +} + +# J is derived from A1 twice. A1 has a member x. +send_gdb "print j.x\n" +gdb_expect { + -re "warning: x ambiguous; using J::L::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re "warning: x ambiguous; using J::K::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print j.x" + } + -re ".*$gdb_prompt $" { fail "print j.x" } + timeout { fail "(timeout) print j.x" } +} + +# JV is derived from A1 but A1 is a virtual base. Should not +# report an ambiguity in this case. +send_gdb "print jv.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jv.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jv.x" } + -re ".*$gdb_prompt $" { fail "print jv.x (??)" } + timeout { fail "(timeout) print jv.x" } +} + +# JVA1 is derived from A1; A1 occurs as a virtual base in two +# ancestors, and as a non-virtual immediate base. Ambiguity must +# be reported. +send_gdb "print jva1.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA1::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re "warning: x ambiguous; using JVA1::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva1.x" + } + -re ".*$gdb_prompt $" { fail "print jva1.x" } + timeout { fail "(timeout) print jva1.x" } +} + +# JVA2 is derived from A1 & A2; A1 occurs as a virtual base in two +# ancestors, and A2 is a non-virtual immediate base. Ambiguity must +# be reported as A1 and A2 both have a member 'x'. +send_gdb "print jva2.x\n" +gdb_expect { + -re "warning: x ambiguous; using JVA2::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re "warning: x ambiguous; using JVA2::KV::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + pass "print jva2.x" + } + -re ".*$gdb_prompt $" { fail "print jva2.x" } + timeout { fail "(timeout) print jva2.x" } +} + +# JVA1V is derived from A1; A1 occurs as a virtual base in two +# ancestors, and also as a virtual immediate base. Ambiguity must +# not be reported. +send_gdb "print jva1v.x\n" +gdb_expect { + -re "warning: x ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { + fail "print jva1v.x (ambiguity reported)" + } + -re "\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" { pass "print jva1v.x" } + -re ".*$gdb_prompt $" { fail "print jva1v.x (??)" } + timeout { fail "(timeout) print jva1v.x" } +} + +# Now check for ambiguous bases. + +# J is derived from A1 twice; report ambiguity if a J is +# cast to an A1. +send_gdb "print (A1)j\n" +gdb_expect { + -re "warning: A1 ambiguous; using J::L::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re "warning: A1 ambiguous; using J::K::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)j" + } + -re ".*$gdb_prompt $" { fail "print (A1)j" } + timeout { fail "(timeout) print (A1)j" } +} + +# JV is derived from A1 twice, but A1 is a virtual base; should +# not report ambiguity when a JV is cast to an A1. +send_gdb "print (A1)jv\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jv (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jv" } + -re ".*$gdb_prompt $" { fail "print (A1)jv (??)" } + timeout { fail "(timeout) print (A1)jv" } +} + +# JVA1 is derived from A1; A1 is a virtual base and also a +# non-virtual base. Must report ambiguity if a JVA1 is cast to an A1. +send_gdb "print (A1)jva1\n" +gdb_expect { + -re "warning: A1 ambiguous; using JVA1::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re "warning: A1 ambiguous; using JVA1::KV::A1. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + pass "print (A1)jva1" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1" } + timeout { fail "(timeout) print (A1)jva1" } +} + +# JVA1V is derived from A1; A1 is a virtual base indirectly +# and also directly; must not report ambiguity when a JVA1V is cast to an A1. +send_gdb "print (A1)jva1v\n" +gdb_expect { + -re "warning: A1 ambiguous.*Use a cast to disambiguate.\r\n\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { + fail "print (A1)jva1v (ambiguity reported)" + } + -re "\\$\[0-9\]* = \{x = \[-\]*\[0-9\]*, y = \[-\]*\[0-9\]*\}\r\n$gdb_prompt $" { pass "print (A1)jva1v" + } + -re ".*$gdb_prompt $" { fail "print (A1)jva1v (??)" } + timeout { fail "(timeout) print (A1)jva1v" } +} + diff --git a/gdb/testsuite/gdb.c++/ctti.exp b/gdb/testsuite/gdb.c++/ctti.exp new file mode 100644 index 00000000000..b8c7cc91e5e --- /dev/null +++ b/gdb/testsuite/gdb.c++/ctti.exp @@ -0,0 +1,268 @@ +# Copyright (C) 1998 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + + +# This file is part of the gdb testsuite +# file written by Elena Zannoni (ezannoni@cygnus.com) +# +# source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc +# + + +if $tracelevel then { + strace $tracelevel +} + + +# Check to see if we have an executable to test. If not, then either we +# haven't tried to compile one, or the compilation failed for some reason. +# In either case, just notify the user and skip the tests in this file. + +set testfile "cttiadd" +set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc +set srcfile2 ${testfile}2.cc +set srcfile3 ${testfile}3.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + +if { $gcc_compiled } then { continue } + +#if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } { +# gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +#} + +set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}" + +remote_exec build $cmdline + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + + +if ![runto_main] then { + perror "couldn't run to breakpoint" + continue +} + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = 2;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = 4.5;.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "n\n" +gdb_expect { + -re "$decimal.*add1\\(\\);.*$gdb_prompt $" { + pass "next " + } + -re ".*$gdb_prompt $" { fail "next " } + timeout { fail "next " } + } + +send_gdb "print c\n" +gdb_expect { + -re ".$decimal = -62.*\r\n$gdb_prompt $" { + pass "print value of c" + } + -re ".*$gdb_prompt $" { fail "print value of c" } + timeout { fail "(timeout) print value of c" } + } + + +send_gdb "print f\n" +gdb_expect { + -re ".$decimal = 9\r\n$gdb_prompt $" { + pass "print value of f" + } + -re ".*$gdb_prompt $" { fail "print value of f" } + timeout { fail "(timeout) print value of f" } + } + + +send_gdb "print i\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of i" + } + -re ".*$gdb_prompt $" { fail "print value of i" } + timeout { fail "(timeout) print value of i" } + } + + + +send_gdb "print add<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" } + timeout { fail "(timeout) print value of add<int>(2,2)" } + } + +send_gdb "print add<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add<float>(2.3,2.3)" } + } + +send_gdb "print add<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" } + timeout { fail "(timeout) print value of add<char>('A','A')" } + } + + +send_gdb "print add2<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add2<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" } + timeout { fail "(timeout) print value of add2<int>(2,2)" } + } + +send_gdb "print add2<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add2<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" } + } + +send_gdb "print add2<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add2<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" } + timeout { fail "(timeout) print value of add2<char>('A','A')" } + } + +send_gdb "print add3<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add3<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" } + timeout { fail "(timeout) print value of add3<int>(2,2)" } + } + +send_gdb "print add3<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add3<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" } + } + +send_gdb "print add3<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add3<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" } + timeout { fail "(timeout) print value of add3<char>('A','A')" } + } + +send_gdb "print add4<int>(2,2)\n" +gdb_expect { + -re ".$decimal = 4\r\n$gdb_prompt $" { + pass "print value of add4<int>(2,2)" + } + -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" } + timeout { fail "(timeout) print value of add4<int>(2,2)" } + } + +send_gdb "print add4<float>(2.3,2.3)\n" +gdb_expect { + -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" { + pass "print value of add4<float>(2.3,2.3)" + } + -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" } + timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" } + } + +send_gdb "print add4<char>('A','A')\n" +gdb_expect { + -re ".$decimal = -126.*202.\r\n$gdb_prompt $" { + pass "print value of add4<char>('A','A')" + } + -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" } + timeout { fail "(timeout) print value of add4<char>('A','A')" } + } + + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.c++/cttiadd.cc b/gdb/testsuite/gdb.c++/cttiadd.cc new file mode 100644 index 00000000000..1f50fae24c1 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd.cc @@ -0,0 +1,29 @@ +template<class T> T add(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; + } + +int main() +{ + char c; + int i; + float f; + extern void add1(); + extern void subr2(); + extern void subr3(); + + c = 'a'; + i = 2; + f = 4.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); + + add1(); + subr2(); + subr3(); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd1.cc b/gdb/testsuite/gdb.c++/cttiadd1.cc new file mode 100644 index 00000000000..7113ecea421 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd1.cc @@ -0,0 +1,16 @@ +template<class T> T add(T v1, T v2); + +void add1() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add(c, c); + i = add(i, i); + f = add(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd2.cc b/gdb/testsuite/gdb.c++/cttiadd2.cc new file mode 100644 index 00000000000..d0d9891fb2f --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd2.cc @@ -0,0 +1,22 @@ +template<class T> T add2(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr2() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add2(c, c); + i = add2(i, i); + f = add2(f, f); +} diff --git a/gdb/testsuite/gdb.c++/cttiadd3.cc b/gdb/testsuite/gdb.c++/cttiadd3.cc new file mode 100644 index 00000000000..7ba1b019f16 --- /dev/null +++ b/gdb/testsuite/gdb.c++/cttiadd3.cc @@ -0,0 +1,33 @@ +template<class T> T add3(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +template<class T> T add4(T v1, T v2) +{ + T v3; + v3 = v1; + v3 += v2; + return v3; +} + +void subr3() +{ + char c; + int i; + float f; + + c = 'b'; + i = 3; + f = 6.5; + + c = add3(c, c); + i = add3(i, i); + f = add3(f, f); + c = add4(c, c); + i = add4(i, i); + f = add4(f, f); +} diff --git a/readline/doc/manvers.texinfo b/readline/doc/manvers.texinfo new file mode 100644 index 00000000000..63924e3801d --- /dev/null +++ b/readline/doc/manvers.texinfo @@ -0,0 +1,6 @@ +@set EDITION 4.0 +@set VERSION 4.0 +@set UPDATED 31 December 1998 +@set UPDATE-MONTH December 1998 + +@set LASTCHANGE Thu Dec 31 10:17:05 EST 1998 diff --git a/readline/examples/rlversion.c b/readline/examples/rlversion.c new file mode 100644 index 00000000000..2d73a96c386 --- /dev/null +++ b/readline/examples/rlversion.c @@ -0,0 +1,21 @@ +/* + * rlversion -- print out readline's version number + */ + +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include <config.h> +#endif + +#include <stdio.h> +#include <sys/types.h> +#include "posixstat.h" + +#include "readline.h" + +main() +{ + printf ("%s\n", rl_library_version ? rl_library_version : "unknown"); + exit (0); +} diff --git a/readline/rlstdc.h b/readline/rlstdc.h new file mode 100644 index 00000000000..08b0f89aa2e --- /dev/null +++ b/readline/rlstdc.h @@ -0,0 +1,79 @@ +/* stdc.h -- macros to make source compile on both ANSI C and K&R C + compilers. */ + +/* Copyright (C) 1993 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash 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 1, or (at your option) + any later version. + + Bash 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 Bash; see the file COPYING. If not, write to the Free + Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#if !defined (_RL_STDC_H_) +#define _RL_STDC_H_ + +/* Adapted from BSD /usr/include/sys/cdefs.h. */ + +/* A function can be defined using prototypes and compile on both ANSI C + and traditional C compilers with something like this: + extern char *func __P((char *, char *, int)); */ + +#if defined (__STDC__) + +# if !defined (__P) +# define __P(protos) protos +# endif +# define __STRING(x) #x + +# if !defined (__GNUC__) +# define inline +# endif + +#else /* !__STDC__ */ + +# if !defined (__P) +# define __P(protos) () +# endif +# define __STRING(x) "x" + +#if defined (__GNUC__) /* gcc with -traditional */ +# if !defined (const) +# define const __const +# endif +# if !defined (inline) +# define inline __inline +# endif +# if !defined (signed) +# define signed __signed +# endif +# if !defined (volatile) +# define volatile __volatile +# endif +#else /* !__GNUC__ */ +# if !defined (const) +# define const +# endif +# if !defined (inline) +# define inline +# endif +# if !defined (signed) +# define signed +# endif +# if !defined (volatile) +# define volatile +# endif +#endif /* !__GNUC__ */ + +#endif /* !__STDC__ */ + +#endif /* !_RL_STDC_H_ */ diff --git a/readline/savestring.c b/readline/savestring.c new file mode 100644 index 00000000000..3f53a87bcd1 --- /dev/null +++ b/readline/savestring.c @@ -0,0 +1,33 @@ +/* savestring.c */ + +/* Copyright (C) 1998 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library, a library for + reading lines of text with interactive input and history editing. + + The GNU Readline Library 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 1, or + (at your option) any later version. + + The GNU Readline Library 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. + + 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, + 675 Mass Ave, Cambridge, MA 02139, USA. */ + +extern char *strcpy (); +extern char *xmalloc (); + +/* Backwards compatibility, now that savestring has been removed from + all `public' readline header files. */ +char * +savestring (s) + char *s; +{ + return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s))); +} diff --git a/readline/shlib/Makefile.in b/readline/shlib/Makefile.in new file mode 100644 index 00000000000..bff52f7d9bf --- /dev/null +++ b/readline/shlib/Makefile.in @@ -0,0 +1,316 @@ +## -*- text -*- ## +# Makefile for the GNU readline library shared library support. +# +# Copyright (C) 1998 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. +RL_LIBRARY_VERSION = @LIBVERSION@ +RL_LIBRARY_NAME = readline + +srcdir = @srcdir@ +VPATH = .:@top_srcdir@ +topdir = @top_srcdir@ +BUILD_DIR = @BUILD_DIR@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +CC = @CC@ +RANLIB = @RANLIB@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +RM = rm -f +CP = cp +MV = mv + +SHELL = @MAKE_SHELL@ + +host_os = @host_os@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ + +CFLAGS = @CFLAGS@ +LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@ + +DEFS = @DEFS@ +LOCAL_DEFS = @LOCAL_DEFS@ + +# +# These values are generated for configure by ${topdir}/support/shobj-conf. +# If your system is not supported by that script, but includes facilities for +# dynamic loading of shared objects, please update the script and send the +# changes to bash-maintainers@gnu.org. +# +SHOBJ_CC = @SHOBJ_CC@ +SHOBJ_CFLAGS = @SHOBJ_CFLAGS@ +SHOBJ_LD = @SHOBJ_LD@ + +SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ +SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@ +SHOBJ_LIBS = @SHOBJ_LIBS@ + +SHLIB_XLDFLAGS = @SHLIB_XLDFLAGS@ +SHLIB_LIBS = @SHLIB_LIBS@ +SHLIB_LIBSUFF = @SHLIB_LIBSUFF@ + +SHLIB_LIBVERSION = @SHLIB_LIBVERSION@ + +SHLIB_STATUS = @SHLIB_STATUS@ + +# shared library versioning +SHLIB_MAJOR= 4 +# shared library systems like SVR4's do not use minor versions +SHLIB_MINOR= .0 + +# For libraries which include headers from other libraries. +INCLUDES = -I. -I.. -I$(topdir) -I$(includedir) + +CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS) + +.SUFFIXES: .so + +.c.so: + ${RM} $@ + $(SHOBJ_CC) -c $(CCFLAGS) $(SHOBJ_CFLAGS) -o $*.o $< + $(MV) $*.o $@ + +# The name of the main library target. + +SHARED_READLINE = libreadline.$(SHLIB_LIBVERSION) +SHARED_HISTORY = libhistory.$(SHLIB_LIBVERSION) +SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY) + +# The C code source files for this library. +CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \ + $(topdir)/vi_mode.c $(topdir)/parens.c $(topdir)/rltty.c \ + $(topdir)/complete.c $(topdir)/bind.c $(topdir)/isearch.c \ + $(topdir)/display.c $(topdir)/signals.c $(topdir)/emacs_keymap.c \ + $(topdir)/vi_keymap.c $(topdir)/util.c $(topdir)/kill.c \ + $(topdir)/undo.c $(topdir)/macro.c $(topdir)/input.c \ + $(topdir)/callback.c $(topdir)/terminal.c $(topdir)/xmalloc.c \ + $(topdir)/history.c $(topdir)/histsearch.c $(topdir)/histexpand.c \ + $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \ + $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c + +# The header files for this library. +HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \ + posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \ + ansi_stdlib.h tcap.h + +SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so +SHARED_TILDEOBJ = tilde.so +SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \ + rltty.so complete.so bind.so isearch.so display.so signals.so \ + util.so kill.so undo.so macro.so input.so callback.so terminal.so \ + nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) + +########################################################################## + +all: $(SHLIB_STATUS) + +supported: $(SHARED_LIBS) + +unsupported: + @echo "Your system and compiler (${host_os}-${CC}) are not supported by the" + @echo "${topdir}/support/shobj-conf script." + @echo "If your operating system provides facilities for creating" + @echo "shared libraries, please update the script and re-run configure. + @echo "Please send the changes you made to bash-maintainers@gnu.org" + @echo "for inclusion in future bash and readline releases." + +$(SHARED_READLINE): $(SHARED_OBJ) + $(RM) $@ + $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS) + +$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so + $(RM) $@ + $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so $(SHLIB_LIBS) + +installdirs: $(topdir)/support/mkdirs + -$(SHELL) $(topdir)/support/mkdirs $(libdir) + +install: installdirs $(SHLIB_STATUS) + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY) + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -i "$(INSTALL_DATA)" $(SHARED_READLINE) + @echo install: you may need to run ldconfig + +uninstall: + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -U $(SHARED_HISTORY) + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -U $(SHARED_READLINE) + @echo uninstall: you may need to run ldconfig + +clean mostlyclean: force + $(RM) $(SHARED_OBJ) $(SHARED_LIBS) + +distclean maintainer-clean: clean + $(RM) Makefile + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +# Dependencies +bind.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h +bind.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +bind.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +bind.so: $(topdir)/tilde.h $(topdir)/history.h +callback.so: $(topdir)/rlconf.h +callback.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h +callback.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +callback.so: $(topdir)/tilde.h +complete.so: $(topdir)/ansi_stdlib.h posixdir.h $(topdir)/posixstat.h +complete.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +complete.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +complete.so: $(topdir)/tilde.h +display.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h +display.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +display.so: $(topdir)/tcap.h +display.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +display.so: $(topdir)/tilde.h $(topdir)/history.h +funmap.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +funmap.so: $(topdir)/rlconf.h $(topdir)/ansi_stdlib.h +funmap.so: ${BUILD_DIR}/config.h $(topdir)/tilde.h +histexpand.so: $(topdir)/ansi_stdlib.h +histexpand.so: $(topdir)/history.h histlib.h +histexpand.so: ${BUILD_DIR}/config.h +histfile.so: $(topdir)/ansi_stdlib.h +histfile.so: $(topdir)/history.h histlib.h +histfile.so: ${BUILD_DIR}/config.h +history.so: $(topdir)/ansi_stdlib.h +history.so: $(topdir)/history.h histlib.h +history.so: ${BUILD_DIR}/config.h +histsearch.so: $(topdir)/ansi_stdlib.h +histsearch.so: $(topdir)/history.h histlib.h +histsearch.so: ${BUILD_DIR}/config.h +input.so: $(topdir)/ansi_stdlib.h +input.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +input.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +input.so: $(topdir)/tilde.h +isearch.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +isearch.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +isearch.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h +keymaps.so: emacs_keymap.c vi_keymap.c +keymaps.so: $(topdir)/keymaps.h $(topdir)/chardefs.h $(topdir)/rlconf.h +keymaps.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +keymaps.so: ${BUILD_DIR}/config.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h +kill.so: $(topdir)/ansi_stdlib.h +kill.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +kill.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +kill.so: $(topdir)/tilde.h $(topdir)/history.h +macro.so: $(topdir)/ansi_stdlib.h +macro.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +macro.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +macro.so: $(topdir)/tilde.h $(topdir)/history.h +nls.so: $(topdir)/ansi_stdlib.h +nls.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +parens.so: $(topdir)/rlconf.h ${BUILD_DIR}/config.h +parens.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +parens.so: $(topdir)/tilde.h +readline.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +readline.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +readline.so: $(topdir)/history.h $(topdir)/tilde.h +readline.so: $(topdir)/posixstat.h $(topdir)/ansi_stdlib.h $(topdir)/posixjmp.h +rltty.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +rltty.so: $(topdir)/rltty.h $(topdir)/tilde.h +rltty.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +search.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +search.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +search.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h +signals.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +signals.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +signals.so: $(topdir)/history.h $(topdir)/tilde.h +terminal.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +terminal.so: $(topdir)/tcap.h +terminal.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +terminal.so: $(topdir)/tilde.h $(topdir)/history.h +tilde.so: $(topdir)/ansi_stdlib.h ${BUILD_DIR}/config.h $(topdir)/tilde.h +undo.so: $(topdir)/ansi_stdlib.h +undo.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +undo.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +undo.so: $(topdir)/tilde.h $(topdir)/history.h +util.so: $(topdir)/posixjmp.h $(topdir)/ansi_stdlib.h +util.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +util.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +util.so: $(topdir)/tilde.h +vi_mode.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +vi_mode.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +vi_mode.so: $(topdir)/history.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h +xmalloc.so: ${BUILD_DIR}/config.h +xmalloc.so: $(topdir)/ansi_stdlib.h + +readline.so: $(topdir)/readline.c +vi_mode.so: $(topdir)/vi_mode.c +funmap.so: $(topdir)/funmap.c +keymaps.so: $(topdir)/keymaps.c +parens.so: $(topdir)/parens.c +search.so: $(topdir)/search.c +rltty.so: $(topdir)/rltty.c +complete.so: $(topdir)/complete.c +bind.so: $(topdir)/bind.c +isearch.so: $(topdir)/isearch.c +display.so: $(topdir)/display.c +signals.so: $(topdir)/signals.c +util.so: $(topdir)/util.c +kill.so: $(topdir)/kill.c +undo.so: $(topdir)/undo.c +macro.so: $(topdir)/macro.c +input.so: $(topdir)/input.c +callback.so: $(topdir)/callback.c +terminal.so: $(topdir)/terminal.c +nls.so: $(topdir)/nls.c +xmalloc.so: $(topdir)/xmalloc.c +history.so: $(topdir)/history.c +histexpand.so: $(topdir)/histexpand.c +histfile.so: $(topdir)/histfile.c +histsearch.so: $(topdir)/histsearch.c +savestring.so: $(topdir)/savestring.c +shell.so: $(topdir)/shell.c +tilde.so: $(topdir)/tilde.c + +readline.so: readline.c +vi_mode.so: vi_mode.c +funmap.so: funmap.c +keymaps.so: keymaps.c +parens.so: parens.c +search.so: search.c +rltty.so: rltty.c +complete.so: complete.c +bind.so: bind.c +isearch.so: isearch.c +display.so: display.c +signals.so: signals.c +util.so: util.c +kill.so: kill.c +undo.so: undo.c +macro.so: macro.c +input.so: input.c +callback.so: callback.c +terminal.so: terminal.c +nls.so: nls.c +xmalloc.so: xmalloc.c +history.so: history.c +histexpand.so: histexpand.c +histfile.so: histfile.c +histsearch.so: histsearch.c +savestring.so: savestring.c +shell.so: shell.c +tilde.so: tilde.c diff --git a/readline/support/shlib-install b/readline/support/shlib-install new file mode 100755 index 00000000000..e43a7c0935f --- /dev/null +++ b/readline/support/shlib-install @@ -0,0 +1,105 @@ +#! /bin/sh +# +# shlib-install - install a shared library and do any necessary host-specific +# post-installation configuration (like ldconfig) +# +# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library +# +# Chet Ramey +# chet@po.cwru.edu + +# +# defaults +# +INSTALLDIR=/usr/local/lib +LDCONFIG=ldconfig + +PROGNAME=`basename $0` +USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library" + +# process options + +while [ $# -gt 0 ]; do + case "$1" in + -O) shift; host_os="$1"; shift ;; + -d) shift; INSTALLDIR="$1"; shift ;; + -i) shift; INSTALLPROG="$1" ; shift ;; + -D) echo=echo ; shift ;; + -U) uninstall=true ; shift ;; + -*) echo "$USAGE" >&2 ; exit 2;; + *) break ;; + esac +done + +# set install target name +LIBNAME="$1" + +if [ -z "$LIBNAME" ]; then + echo "$USAGE" >&2 + exit 2 +fi + +OLDSUFF=old +MV=mv +RM="rm -f" +LN="ln -s" + +# pre-install + +if [ -z "$uninstall" ]; then + ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF} + if [ -f "$INSTALLDIR/$LIBNAME" ]; then + ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF} + fi +fi + +# install/uninstall + +if [ -z "$uninstall" ] ; then + ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME} +else + ${echo} ${RM} ${INSTALLDIR}/${LIBNAME} +fi + +# post-install/uninstall + +case "$LIBNAME" in +*.*.[0-9].[0-9]) # libname.so.M.N + LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M + LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'` # libname.so + ;; +*.*.[0-9]) # libname.so.M + LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so + ;; +esac + +# +# Create symlinks to the installed library. This section is incomplete. +# +case "$host_os" in +*linux*|bsdi4*) + # libname.so.M -> libname.so.M.N + ${echo} ${RM} ${INSTALLDIR}/$LINK2 + if [ -z "$uninstall" ]; then + ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2 + fi + + # libname.so -> libname.so.M.N + ${echo} ${RM} ${INSTALLDIR}/$LINK1 + if [ -z "$uninstall" ]; then + ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + fi + ;; + +solaris2*|aix4.[2-9]*|hpux1*) + # libname.so -> libname.so.M + ${echo} ${RM} ${INSTALLDIR}/$LINK1 + if [ -z "$uninstall" ]; then + ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + fi + ;; + +*) ;; +esac + +exit 0 diff --git a/readline/support/shobj-conf b/readline/support/shobj-conf new file mode 100755 index 00000000000..cbd3d1b46c6 --- /dev/null +++ b/readline/support/shobj-conf @@ -0,0 +1,341 @@ +#! /bin/sh +# +# shobj-conf -- output a series of variable assignments to be substituted +# into a Makefile by configure which specify system-dependent +# information for creating shared objects that may be loaded +# into bash with `enable -f' +# +# usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor +# +# Chet Ramey +# chet@po.cwru.edu + +# +# defaults +# +SHOBJ_STATUS=supported +SHLIB_STATUS=supported + +SHOBJ_CC=cc +SHOBJ_CFLAGS= +SHOBJ_LD= +SHOBJ_LDFLAGS= +SHOBJ_XLDFLAGS= +SHOBJ_LIBS= + +SHLIB_XLDFLAGS= +SHLIB_LIBS= +SHLIB_LIBSUFF='so' + +SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)' + +PROGNAME=`basename $0` +USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor" + +while [ $# -gt 0 ]; do + case "$1" in + -C) shift; SHOBJ_CC="$1"; shift ;; + -c) shift; host_cpu="$1"; shift ;; + -o) shift; host_os="$1"; shift ;; + -v) shift; host_vendor="$1"; shift ;; + *) echo "$USAGE" >&2 ; exit 2;; + esac +done + +case "${host_os}-${SHOBJ_CC}" in +sunos4*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD=/usr/bin/ld + SHOBJ_LDFLAGS='-assert pure-text' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +sunos4*) + SHOBJ_CFLAGS=-pic + SHOBJ_LD=/usr/bin/ld + SHOBJ_LDFLAGS='-assert pure-text' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +sunos5*-gcc*|solaris2*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-i' + + SHLIB_XLDFLAGS='-R $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sunos5*|solaris2*) + SHOBJ_CFLAGS='-K pic' + SHOBJ_LD=/usr/ccs/bin/ld + SHOBJ_LDFLAGS='-G -dy -z text -i -h $@' + + SHLIB_XLDFLAGS='-R $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +freebsd2* | netbsd* | openbsd*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-x -Bshareable' + + SHLIB_XLDFLAGS='-R$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +freebsd3*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_XLDFLAGS='-R$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +linux*) + SHOBJ_CFLAGS=-fPIC + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + + SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +bsdi2*) + SHOBJ_CC=shlicc2 + SHOBJ_CFLAGS= + SHOBJ_LD=ld + SHOBJ_LDFLAGS=-r + SHOBJ_LIBS=-lc_s.2.1.0 + + # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in + # the ass -- they require changing {/usr/lib,etc}/shlib.map on + # each system, and the library creation process is byzantine + SHLIB_STATUS=unsupported + ;; + +bsdi3*) + SHOBJ_CC=shlicc2 + SHOBJ_CFLAGS= + SHOBJ_LD=ld + SHOBJ_LDFLAGS=-r + SHOBJ_LIBS=-lc_s.3.0.0 + + # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in + # the ass -- they require changing {/usr/lib,etc}/shlib.map on + # each system, and the library creation process is byzantine + SHLIB_STATUS=unsupported + ;; + +bsdi4*) + # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked + # shared libraries. gcc 2.x is the standard compiler, and the + # `normal' gcc options should work as they do in Linux. + + SHOBJ_CFLAGS=-fPIC + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +osf*) + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"' + + SHLIB_XLDFLAGS='-rpath $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +aix4.[2-9]*-gcc*) # lightly tested by jik@cisco.com + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='ld' + SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' + SHOBJ_XLDFLAGS='-G' + + SHLIB_XLDFLAGS='-bM:SRE' + SHLIB_LIBS='-lcurses -lc' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +aix4.[2-9]*) + SHOBJ_CFLAGS=-K + SHOBJ_LD='ld' + SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' + SHOBJ_XLDFLAGS='-G' + + SHLIB_XLDFLAGS='-bM:SRE' + SHLIB_LIBS='-lcurses -lc' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +# +# THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface +# +irix[56]*-gcc*) + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + + SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +irix[56]*) + SHOBJ_CFLAGS='-K PIC' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@' + + SHLIB_XLDFLAGS='-rpath $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux9*-gcc*) + # must use gcc; the bundled cc cannot compile PIC code + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' + + SHLIB_XLDFLAGS='-Wl,+b,$(libdir)' + SHLIB_LIBSUFF='sl' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux9*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +hpux10*-gcc*) + # must use gcc; the bundled cc cannot compile PIC code + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' + + SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' + SHLIB_LIBSUFF='sl' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux10*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +hpux11*-gcc*) + # must use gcc; the bundled cc cannot compile PIC code + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' +# SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@' + SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s -Wl,+h,$@' + + SHLIB_XLDFLAGS='-Wl,+b,$(libdir)' + SHLIB_LIBSUFF='sl' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux11*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +sysv4*-gcc*) + SHOBJ_CFLAGS=-shared + SHOBJ_LDFLAGS='-shared -h $@' + SHOBJ_LD='${CC}' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sysv4*) + SHOBJ_CFLAGS='-K PIC' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-dy -z text -G -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sco3.2v5*-gcc*) + SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sco3.2v5*) + SHOBJ_CFLAGS='-K pic -b elf' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sysv5uw7*-gcc*) + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sysv5uw7*) + SHOBJ_CFLAGS='-K PIC' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-G -dy -z text -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +dgux*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +dgux*) + SHOBJ_CFLAGS='-K pic' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-G -dy -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; +# +# Rely on correct gcc configuration for everything else +# +*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +esac + +echo SHOBJ_CC=\'"$SHOBJ_CC"\' +echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\' +echo SHOBJ_LD=\'"$SHOBJ_LD"\' +echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\' +echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\' +echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\' + +echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\' +echo SHLIB_LIBS=\'"$SHLIB_LIBS"\' +echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\' +echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\' + +echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\' +echo SHLIB_STATUS=\'"$SHLIB_STATUS"\' + +exit 0 |