* [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems
@ 2011-12-30 10:19 Mike Frysinger
2011-12-30 10:39 ` Joel Brobecker
2011-12-31 7:27 ` Mike Frysinger
0 siblings, 2 replies; 5+ messages in thread
From: Mike Frysinger @ 2011-12-30 10:19 UTC (permalink / raw)
To: gdb-patches
The current erc32 configure script only searches for -ltermcap to provide
any termcap funcs (which readlines needs). When building against a local
readline (which is static), we hit link failures like so:
gcc ...-I/-D flags... -o sis \
sis.o exec.o erc32.o func.o help.o float.o \
../../bfd/libbfd.a ../../opcodes/libopcodes.a \
../../libiberty/libiberty.a -lz -lnsl \
../../readline/libreadline.a -lm
../../readline/libreadline.a(display.o): In function 'cr':
.../readline/display.c:2486: undefined reference to 'tputs'
collect2: ld returned 1 exit status
make[2]: *** [sis] Error 1
Use AC_SEARCH_LIBS to check for ncurses/curses (which should be the
modern equivalent on most systems for libtermcap).
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-12-30 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Change AC_CHECK_LIB to AC_SEARCH_LIBS, and add
ncurses/curses to the library search list.
* configure: Regenerated.
---
sim/erc32/configure.ac | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac
index 5a43b5e..59a000f 100644
--- a/sim/erc32/configure.ac
+++ b/sim/erc32/configure.ac
@@ -17,7 +17,8 @@ lose
if test x$sim_cv_os_cygwin = xyes; then
TERMCAP='`if test -r ../../libtermcap/libtermcap.a; then echo ../../libtermcap/libtermcap.a; else echo -ltermcap; fi` -luser32'
else
- AC_CHECK_LIB(termcap, main, TERMCAP=-ltermcap, TERMCAP="")
+ AC_SEARCH_LIBS(tputs, ncurses curses termcap,
+ [TERMCAP=$ac_cv_search_tputs], [TERMCAP=""])
fi
AC_SUBST(TERMCAP)
--
1.7.6.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems
2011-12-30 10:19 [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems Mike Frysinger
@ 2011-12-30 10:39 ` Joel Brobecker
2011-12-31 2:57 ` Mike Frysinger
2011-12-31 7:27 ` Mike Frysinger
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2011-12-30 10:39 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
> 2011-12-30 Mike Frysinger <vapier@gentoo.org>
>
> * configure.ac: Change AC_CHECK_LIB to AC_SEARCH_LIBS, and add
> ncurses/curses to the library search list.
> * configure: Regenerated.
[...]
> - AC_CHECK_LIB(termcap, main, TERMCAP=-ltermcap, TERMCAP="")
> + AC_SEARCH_LIBS(tputs, ncurses curses termcap,
> + [TERMCAP=$ac_cv_search_tputs], [TERMCAP=""])
Is this going to hurt on non-GNU/Linux systems? In particular,
you have chosen an order that is different from the order selected
in GDB:
# These are the libraries checked by Readline.
AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
On platform providing both termcap and curses, GDB will choose
termcap while the sim will likely choose termcap, and we'll end
up trying to link with both!
Can you try using the same check as in GDB? Do you have to check
for tputs, or does checking for tgetent have the same effect?
Otherwise, can you try at least checking the libraries in the same
order as in GDB?
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems
2011-12-30 10:39 ` Joel Brobecker
@ 2011-12-31 2:57 ` Mike Frysinger
2011-12-31 3:39 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2011-12-31 2:57 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Fri, Dec 30, 2011 at 05:18, Joel Brobecker wrote:
>> 2011-12-30 Mike Frysinger <vapier@gentoo.org>
>>
>> * configure.ac: Change AC_CHECK_LIB to AC_SEARCH_LIBS, and add
>> ncurses/curses to the library search list.
>> * configure: Regenerated.
> [...]
>> - AC_CHECK_LIB(termcap, main, TERMCAP=-ltermcap, TERMCAP="")
>> + AC_SEARCH_LIBS(tputs, ncurses curses termcap,
>> + [TERMCAP=$ac_cv_search_tputs], [TERMCAP=""])
>
> Is this going to hurt on non-GNU/Linux systems? In particular,
> you have chosen an order that is different from the order selected
> in GDB:
i hadn't noticed GDB had a test for it. i'm fine with keeping the two in sync.
maybe extract the termcap m4 code out of gdb and put into a new m4
file in the top level config/ dir ? that way we'd know the two trees
would stay in sync.
-mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems
2011-12-31 2:57 ` Mike Frysinger
@ 2011-12-31 3:39 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2011-12-31 3:39 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
> i hadn't noticed GDB had a test for it. i'm fine with keeping the two
> in sync.
If that works for your case, let's go with that as a first step
(because we can fix it now - see below).
> maybe extract the termcap m4 code out of gdb and put into a new m4
> file in the top level config/ dir ? that way we'd know the two trees
> would stay in sync.
Sounds like a fine idea to me. The extra complication is that I think
the config/ directory is "owned" by gcc. It should not be a problem,
but you'll have to go through them first.
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems
2011-12-30 10:19 [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems Mike Frysinger
2011-12-30 10:39 ` Joel Brobecker
@ 2011-12-31 7:27 ` Mike Frysinger
1 sibling, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2011-12-31 7:27 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: Text/Plain, Size: 823 bytes --]
i've committed this initial fix based on Joel's feedback:
2011-12-31 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Change AC_CHECK_LIB to AC_SEARCH_LIBS to match
the code in gdb's configure.ac with $TERMCAP.
* configure: Regenerated.
--- configure.ac 18 Oct 2011 00:30:57 -0000 1.6
+++ configure.ac 31 Dec 2011 06:58:27 -0000
@@ -17,7 +17,9 @@ lose
if test x$sim_cv_os_cygwin = xyes; then
TERMCAP='`if test -r ../../libtermcap/libtermcap.a; then echo ../../libtermcap/libtermcap.a; else echo -ltermcap; fi` -luser32'
else
- AC_CHECK_LIB(termcap, main, TERMCAP=-ltermcap, TERMCAP="")
+ # Keep in sync with gdb's configure.ac list.
+ AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses],
+ [TERMCAP=$ac_cv_search_tgetent], [TERMCAP=""])
fi
AC_SUBST(TERMCAP)
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-31 7:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-30 10:19 [PATCH] sim: erc32: fix linking against local readline on modern (ncurses) systems Mike Frysinger
2011-12-30 10:39 ` Joel Brobecker
2011-12-31 2:57 ` Mike Frysinger
2011-12-31 3:39 ` Joel Brobecker
2011-12-31 7:27 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox