When I build GDB 5.0 with the Solaris 8 sparc version of gcc (in
/opt/sfw/bin/gcc, shipped on the Software Companion CD), I get a
program that can't be executed.  'ldd gdb' reports:

        libncurses.so.4 =>       (file not found)

The problem is that 'configure' first looks in -lncurses for tgetent,
and /opt/sfw/bin/gcc compiles the program successfully because it
links to /opt/sfw/lib/libncurses.so, but the program doesn't run
because Sun configured gcc to use -L/opt/sfw/lib without using
-R/opt/sfw/lib when linking.  Arguably this is a misfeature of Sun
gcc, but I noticed that gdb/configure.in uses a different search order
for tgetent that readline/aclocal.m4 does, and this inconsistency
should be removed anyway.  Here's a patch.

2000-06-28  Paul Eggert  <[EMAIL PROTECTED]>

        * configure.in (TERM_LIB): When searching for libraries
        containing tgetent, prefer termcap, curses, then ncurses.
        This is the same order as ../readline/aclocal.m4, and it works
        around a bug in the GCC 2.95.2 installation that is shipped
        with Solaris 8.

===================================================================
RCS file: configure.in,v
retrieving revision 5.0
retrieving revision 5.0.0.1
diff -pu -r5.0 -r5.0.0.1
--- configure.in        2000/05/11 00:32:18     5.0
+++ configure.in        2000/06/28 20:13:52     5.0.0.1
@@ -588,11 +588,11 @@ if test x$gdb_cv_os_cygwin = xyes; then
   TERM_LIB='`if test -r ../libtermcap/libtermcap.a; then echo 
../libtermcap/libtermcap.a; else echo -ltermcap; fi`'
 else
   TERM_LIB=
-  AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses,
-    AC_CHECK_LIB(Hcurses, tgetent, TERM_LIB=-lHcurses,
-      AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib,
-        AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap,
-         AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses,
+  AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap,
+    AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses,
+      AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses,
+       AC_CHECK_LIB(Hcurses, tgetent, TERM_LIB=-lHcurses,
+         AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib,
            AC_CHECK_LIB(terminfo, tgetent, TERM_LIB=-lterminfo))))))
 
   if test "x$TERM_LIB" = x

Reply via email to